comparison core/modules/layout_builder/src/LayoutBuilderHighlightTrait.php @ 18:af1871eacc83

Update to Drupal core 8.7.1
author Chris Cannam
date Thu, 09 May 2019 15:33:08 +0100
parents
children
comparison
equal deleted inserted replaced
17:129ea1e6d783 18:af1871eacc83
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 }