Code Coverage |
||||||||||||||||
Lines |
Branches |
Paths |
Functions and Methods |
Classes and Traits |
||||||||||||
| Total | |
0.00% |
0 / 14 |
|
0.00% |
0 / 3 |
|
0.00% |
0 / 3 |
|
0.00% |
0 / 3 |
CRAP | |
0.00% |
0 / 1 |
| LibrariesPanel | |
0.00% |
0 / 6 |
|
0.00% |
0 / 3 |
|
0.00% |
0 / 3 |
|
0.00% |
0 / 3 |
12 | |
0.00% |
0 / 1 |
| keyboardShortcuts | |
0.00% |
0 / 4 |
|
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| isDeferrable | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| build | |
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\Plugin\display_builder\Island; |
| 6 | |
| 7 | use Drupal\Core\StringTranslation\TranslatableMarkup; |
| 8 | use Drupal\display_builder\Attribute\Island; |
| 9 | use Drupal\display_builder\InstanceInterface; |
| 10 | use Drupal\display_builder\Island\IslandPluginBase; |
| 11 | use Drupal\display_builder\Island\IslandType; |
| 12 | |
| 13 | /** |
| 14 | * Library island plugin implementation. |
| 15 | */ |
| 16 | #[Island( |
| 17 | id: 'library', |
| 18 | enabled_by_default: TRUE, |
| 19 | label: new TranslatableMarkup('Libraries'), |
| 20 | description: new TranslatableMarkup('Pick elements from libraries and drop them in the display.'), |
| 21 | type: IslandType::View, |
| 22 | default_region: 'sidebar', |
| 23 | icon: 'collection', |
| 24 | )] |
| 25 | class LibrariesPanel extends IslandPluginBase { |
| 26 | |
| 27 | /** |
| 28 | * {@inheritdoc} |
| 29 | */ |
| 30 | public static function keyboardShortcuts(): array { |
| 31 | return [ |
| 32 | 'key' => 'l', |
| 33 | 'help' => t('Show the libraries'), |
| 34 | ]; |
| 35 | } |
| 36 | |
| 37 | /** |
| 38 | * {@inheritdoc} |
| 39 | */ |
| 40 | public function isDeferrable(): bool { |
| 41 | // This panel's content is not built here: ProfileViewBuilder assembles the |
| 42 | // Library islands and injects them into this pane. build() returns nothing, |
| 43 | // so a deferred reload would swap the panel's content away for an empty |
| 44 | // one. The panel is static anyway - it reflects profile configuration, not |
| 45 | // builder state, so it never goes stale and has nothing to defer. |
| 46 | // |
| 47 | // Can go once the build logic moves here, @see build(). |
| 48 | return FALSE; |
| 49 | } |
| 50 | |
| 51 | /** |
| 52 | * {@inheritdoc} |
| 53 | */ |
| 54 | public function build(InstanceInterface $builder, array $data = [], array $options = []): array { |
| 55 | // @todo Move the logic here. |
| 56 | // @see https://www.drupal.org/project/display_builder/issues/3542866 |
| 57 | return []; |
| 58 | } |
| 59 | |
| 60 | } |