trait LayoutBuilderHighlightTrait

Same name in other branches
  1. 9 core/modules/layout_builder/src/LayoutBuilderHighlightTrait.php \Drupal\layout_builder\LayoutBuilderHighlightTrait
  2. 8.9.x core/modules/layout_builder/src/LayoutBuilderHighlightTrait.php \Drupal\layout_builder\LayoutBuilderHighlightTrait
  3. 11.x core/modules/layout_builder/src/LayoutBuilderHighlightTrait.php \Drupal\layout_builder\LayoutBuilderHighlightTrait

A trait for generating IDs used to highlight active UI elements.

Hierarchy

8 files declare their use of LayoutBuilderHighlightTrait
AddBlockForm.php in core/modules/layout_builder/src/Form/AddBlockForm.php
ChooseBlockController.php in core/modules/layout_builder/src/Controller/ChooseBlockController.php
ChooseSectionController.php in core/modules/layout_builder/src/Controller/ChooseSectionController.php
ConfigureSectionForm.php in core/modules/layout_builder/src/Form/ConfigureSectionForm.php
LayoutBuilder.php in core/modules/layout_builder/src/Element/LayoutBuilder.php

... See full list

File

core/modules/layout_builder/src/LayoutBuilderHighlightTrait.php, line 8

Namespace

Drupal\layout_builder
View source
trait LayoutBuilderHighlightTrait {
    
    /**
     * Provides the ID used to highlight the active Layout Builder UI element.
     *
     * @param string $delta
     *   The section the block is in.
     * @param string $region
     *   The section region in which the block is placed.
     *
     * @return string
     *   The highlight ID of the block.
     */
    protected function blockAddHighlightId($delta, $region) {
        return "block-{$delta}-{$region}";
    }
    
    /**
     * Provides the ID used to highlight the active Layout Builder UI element.
     *
     * @param string $uuid
     *   The uuid of the block.
     *
     * @return string
     *   The highlight ID of the block.
     */
    protected function blockUpdateHighlightId($uuid) {
        return $uuid;
    }
    
    /**
     * Provides the ID used to highlight the active Layout Builder UI element.
     *
     * @param string $delta
     *   The location of the section.
     *
     * @return string
     *   The highlight ID of the section.
     */
    protected function sectionAddHighlightId($delta) {
        return "section-{$delta}";
    }
    
    /**
     * Provides the ID used to highlight the active Layout Builder UI element.
     *
     * @param string $delta
     *   The location of the section.
     *
     * @return string
     *   The highlight ID of the section.
     */
    protected function sectionUpdateHighlightId($delta) {
        return "section-update-{$delta}";
    }

}

Members

Title Sort descending Modifiers Object type Summary
LayoutBuilderHighlightTrait::blockAddHighlightId protected function Provides the ID used to highlight the active Layout Builder UI element.
LayoutBuilderHighlightTrait::blockUpdateHighlightId protected function Provides the ID used to highlight the active Layout Builder UI element.
LayoutBuilderHighlightTrait::sectionAddHighlightId protected function Provides the ID used to highlight the active Layout Builder UI element.
LayoutBuilderHighlightTrait::sectionUpdateHighlightId protected function Provides the ID used to highlight the active Layout Builder UI element.

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.