Code Coverage |
||||||||||||||||
Lines |
Branches |
Paths |
Functions and Methods |
Classes and Traits |
||||||||||||
| Total | |
0.00% |
0 / 5 |
|
0.00% |
0 / 5 |
|
0.00% |
0 / 5 |
|
0.00% |
0 / 5 |
CRAP | |
0.00% |
0 / 1 |
| IslandStructureReloadTrait | |
0.00% |
0 / 5 |
|
0.00% |
0 / 5 |
|
0.00% |
0 / 5 |
|
0.00% |
0 / 5 |
30 | |
0.00% |
0 / 1 |
| onAttachToRoot | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| onAttachToSlot | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| onMove | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| onUpdate | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| onDelete | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| 1 | <?php |
| 2 | |
| 3 | declare(strict_types=1); |
| 4 | |
| 5 | namespace Drupal\display_builder\Island; |
| 6 | |
| 7 | use Drupal\display_builder\InstanceInterface; |
| 8 | |
| 9 | /** |
| 10 | * Reload implementation for IslandStructureEventsInterface methods. |
| 11 | * |
| 12 | * Provides onAttachToRoot, onAttachToSlot, onMove, onUpdate, and onDelete |
| 13 | * handlers that all delegate to reloadWithGlobalData(), which the using |
| 14 | * island plugin must provide. |
| 15 | * |
| 16 | * Use this trait when an island should fully reload its content in response |
| 17 | * to any structural mutation of the builder tree. |
| 18 | * |
| 19 | * @see \Drupal\display_builder\Island\IslandReloadEventsTrait |
| 20 | * |
| 21 | * @phpcs:disable Generic.CodeAnalysis.UnusedFunctionParameter.FoundAfterLastUsed |
| 22 | */ |
| 23 | trait IslandStructureReloadTrait { |
| 24 | |
| 25 | /** |
| 26 | * {@inheritdoc} |
| 27 | */ |
| 28 | public function onAttachToRoot(InstanceInterface $instance, string $node_id): array { |
| 29 | return $this->reloadWithGlobalData($instance); |
| 30 | } |
| 31 | |
| 32 | /** |
| 33 | * {@inheritdoc} |
| 34 | */ |
| 35 | public function onAttachToSlot(InstanceInterface $instance, string $node_id, string $parent_id): array { |
| 36 | return $this->reloadWithGlobalData($instance); |
| 37 | } |
| 38 | |
| 39 | /** |
| 40 | * {@inheritdoc} |
| 41 | */ |
| 42 | public function onMove(InstanceInterface $instance, string $node_id): array { |
| 43 | return $this->reloadWithGlobalData($instance); |
| 44 | } |
| 45 | |
| 46 | /** |
| 47 | * {@inheritdoc} |
| 48 | */ |
| 49 | public function onUpdate(InstanceInterface $instance, string $node_id): array { |
| 50 | return $this->reloadWithGlobalData($instance); |
| 51 | } |
| 52 | |
| 53 | /** |
| 54 | * {@inheritdoc} |
| 55 | */ |
| 56 | public function onDelete(InstanceInterface $instance, ?string $parent_id): array { |
| 57 | return $this->reloadWithGlobalData($instance); |
| 58 | } |
| 59 | |
| 60 | } |