Code Coverage |
||||||||||||||||
Lines |
Branches |
Paths |
Functions and Methods |
Classes and Traits |
||||||||||||
| Total | |
0.00% |
0 / 3 |
|
0.00% |
0 / 3 |
|
0.00% |
0 / 3 |
|
0.00% |
0 / 3 |
CRAP | |
0.00% |
0 / 1 |
| IslandLifecycleReloadTrait | |
0.00% |
0 / 3 |
|
0.00% |
0 / 3 |
|
0.00% |
0 / 3 |
|
0.00% |
0 / 3 |
12 | |
0.00% |
0 / 1 |
| onHistoryChange | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| onRestore | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| onRevert | |
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 IslandLifecycleEventsInterface methods. |
| 11 | * |
| 12 | * Provides onHistoryChange, onRestore, and onRevert handlers that all |
| 13 | * delegate to reloadWithGlobalData(), which the using island plugin must |
| 14 | * provide. |
| 15 | * |
| 16 | * Use this trait when an island should fully reload its content in response |
| 17 | * to history pointer changes, state restores, or entity view reverts. |
| 18 | */ |
| 19 | trait IslandLifecycleReloadTrait { |
| 20 | |
| 21 | /** |
| 22 | * {@inheritdoc} |
| 23 | */ |
| 24 | public function onHistoryChange(InstanceInterface $instance): array { |
| 25 | return $this->reloadWithGlobalData($instance); |
| 26 | } |
| 27 | |
| 28 | /** |
| 29 | * {@inheritdoc} |
| 30 | */ |
| 31 | public function onRestore(InstanceInterface $instance): array { |
| 32 | return $this->reloadWithGlobalData($instance); |
| 33 | } |
| 34 | |
| 35 | /** |
| 36 | * {@inheritdoc} |
| 37 | */ |
| 38 | public function onRevert(InstanceInterface $instance): array { |
| 39 | return $this->reloadWithGlobalData($instance); |
| 40 | } |
| 41 | |
| 42 | } |