"Fossies" - the Fresh Open Source Software Archive

Member "drupal-8.9.10/core/modules/layout_builder/src/LayoutBuilderHighlightTrait.php" (26 Nov 2020, 1472 Bytes) of package /linux/www/drupal-8.9.10.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) PHP source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "LayoutBuilderHighlightTrait.php" see the Fossies "Dox" file reference documentation.

    1 <?php
    2 
    3 namespace Drupal\layout_builder;
    4 
    5 /**
    6  * A trait for generating IDs used to highlight active UI elements.
    7  */
    8 trait LayoutBuilderHighlightTrait {
    9 
   10   /**
   11    * Provides the ID used to highlight the active Layout Builder UI element.
   12    *
   13    * @param string $delta
   14    *   The section the block is in.
   15    * @param string $region
   16    *   The section region in which the block is placed.
   17    *
   18    * @return string
   19    *   The highlight ID of the block.
   20    */
   21   protected function blockAddHighlightId($delta, $region) {
   22     return "block-$delta-$region";
   23   }
   24 
   25   /**
   26    * Provides the ID used to highlight the active Layout Builder UI element.
   27    *
   28    * @param string $uuid
   29    *   The uuid of the block.
   30    *
   31    * @return string
   32    *   The highlight ID of the block.
   33    */
   34   protected function blockUpdateHighlightId($uuid) {
   35     return $uuid;
   36   }
   37 
   38   /**
   39    * Provides the ID used to highlight the active Layout Builder UI element.
   40    *
   41    * @param string $delta
   42    *   The location of the section.
   43    *
   44    * @return string
   45    *   The highlight ID of the section.
   46    */
   47   protected function sectionAddHighlightId($delta) {
   48     return "section-$delta";
   49   }
   50 
   51   /**
   52    * Provides the ID used to highlight the active Layout Builder UI element.
   53    *
   54    * @param string $delta
   55    *   The location of the section.
   56    *
   57    * @return string
   58    *   The highlight ID of the section.
   59    */
   60   protected function sectionUpdateHighlightId($delta) {
   61     return "section-update-$delta";
   62   }
   63 
   64 }