Code Coverage |
||||||||||||||||
Lines |
Branches |
Paths |
Functions and Methods |
Classes and Traits |
||||||||||||
| Total | |
0.00% |
0 / 13 |
|
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
CRAP | |
0.00% |
0 / 1 |
| MenuDelete | |
0.00% |
0 / 7 |
|
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 1 |
| build | |
0.00% |
0 / 7 |
|
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\IslandPluginBase; |
| 11 | use Drupal\display_builder\IslandType; |
| 12 | |
| 13 | /** |
| 14 | * Menu island plugin implementation. |
| 15 | */ |
| 16 | #[Island( |
| 17 | id: 'menu_delete', |
| 18 | enabled_by_default: TRUE, |
| 19 | label: new TranslatableMarkup('Delete'), |
| 20 | description: new TranslatableMarkup('Remove a component or block.'), |
| 21 | type: IslandType::Menu, |
| 22 | )] |
| 23 | class MenuDelete extends IslandPluginBase { |
| 24 | |
| 25 | /** |
| 26 | * {@inheritdoc} |
| 27 | */ |
| 28 | public function build(InstanceInterface $builder, array $data = [], array $options = []): array { |
| 29 | $builder_id = (string) $builder->id(); |
| 30 | // Attribute data-contextual-menu is important for the js mapping. |
| 31 | // @see assets/js/contextual_menu.js |
| 32 | // Urls are generated with placeholders to be replaced in the js. |
| 33 | $remove = $this->buildMenuItem($this->t('Remove'), 'remove'); |
| 34 | $remove = $this->htmxEvents->onClickDelete($remove, $builder_id, '__node_id__'); |
| 35 | |
| 36 | return [ |
| 37 | $this->buildMenuDivider(), |
| 38 | $remove, |
| 39 | ]; |
| 40 | } |
| 41 | |
| 42 | } |
Below are the source code lines that represent each code path as identified by Xdebug. Please note a path is not
necessarily coterminous with a line, a line may contain multiple paths and therefore show up more than once.
Please also be aware that some paths may include implicit rather than explicit branches, e.g. an if statement
always has an else as part of its logical flow even if you didn't write one.
| 28 | public function build(InstanceInterface $builder, array $data = [], array $options = []): array { |
| 29 | $builder_id = (string) $builder->id(); |
| 30 | // Attribute data-contextual-menu is important for the js mapping. |
| 31 | // @see assets/js/contextual_menu.js |
| 32 | // Urls are generated with placeholders to be replaced in the js. |
| 33 | $remove = $this->buildMenuItem($this->t('Remove'), 'remove'); |
| 34 | $remove = $this->htmxEvents->onClickDelete($remove, $builder_id, '__node_id__'); |
| 35 | |
| 36 | return [ |
| 37 | $this->buildMenuDivider(), |
| 38 | $remove, |