Code Coverage |
||||||||||||||||
Lines |
Branches |
Paths |
Functions and Methods |
Classes and Traits |
||||||||||||
| Total | n/a |
0 / 0 |
n/a |
0 / 0 |
n/a |
0 / 0 |
n/a |
0 / 0 |
CRAP | n/a |
0 / 0 |
|||||
| 1 | <?php |
| 2 | |
| 3 | declare(strict_types=1); |
| 4 | |
| 5 | namespace Drupal\display_builder; |
| 6 | |
| 7 | use Drupal\Component\Plugin\ConfigurableInterface; |
| 8 | use Drupal\Component\Plugin\PluginInspectionInterface; |
| 9 | use Drupal\Core\Form\FormStateInterface; |
| 10 | use Drupal\Core\Plugin\ContainerFactoryPluginInterface; |
| 11 | |
| 12 | /** |
| 13 | * Interface for island plugins. |
| 14 | */ |
| 15 | interface IslandInterface extends ConfigurableInterface, ContainerFactoryPluginInterface, IslandEventSubscriberInterface, PluginInspectionInterface { |
| 16 | |
| 17 | /** |
| 18 | * Define keyboard shortcuts. |
| 19 | * |
| 20 | * @return array |
| 21 | * An associative array of key => description. |
| 22 | */ |
| 23 | public static function keyboardShortcuts(): array; |
| 24 | |
| 25 | /** |
| 26 | * Build renderable from state data. |
| 27 | * |
| 28 | * @param \Drupal\display_builder\InstanceInterface $builder |
| 29 | * Display builder instance. |
| 30 | * @param array $data |
| 31 | * (Optional) UI Patterns 2 sources data. It can be the full data state |
| 32 | * (so, the same as $builder->getCurrentState()) or just some specific data |
| 33 | * of a single source of a sub-tree of sources. |
| 34 | * @param array $options |
| 35 | * (Optional) Additional data to alter the island rendering. |
| 36 | * |
| 37 | * @return array |
| 38 | * A renderable array. |
| 39 | */ |
| 40 | public function build(InstanceInterface $builder, array $data = [], array $options = []): array; |
| 41 | |
| 42 | /** |
| 43 | * Alter form element after its built. |
| 44 | * |
| 45 | * @param array $element |
| 46 | * An associative array containing the structure of the form element. |
| 47 | * @param \Drupal\Core\Form\FormStateInterface $form_state |
| 48 | * The current state of the form. |
| 49 | * |
| 50 | * @return array |
| 51 | * The altered form element. |
| 52 | */ |
| 53 | public function afterBuild(array $element, FormStateInterface $form_state): array; |
| 54 | |
| 55 | /** |
| 56 | * Returns the translated plugin label. |
| 57 | * |
| 58 | * @return string |
| 59 | * The island label. |
| 60 | */ |
| 61 | public function label(): string; |
| 62 | |
| 63 | /** |
| 64 | * Get island type value. |
| 65 | * |
| 66 | * @return string |
| 67 | * The type value attribute value. |
| 68 | */ |
| 69 | public function getTypeId(): string; |
| 70 | |
| 71 | /** |
| 72 | * Get HTML ID. |
| 73 | * |
| 74 | * This ID is used to update an interactive island. |
| 75 | * |
| 76 | * @param string $builder_id |
| 77 | * Builder ID. |
| 78 | * |
| 79 | * @return string |
| 80 | * The HTML ID attribute value. |
| 81 | */ |
| 82 | public function getHtmlId(string $builder_id): string; |
| 83 | |
| 84 | /** |
| 85 | * Returns the icon if any. |
| 86 | * |
| 87 | * @return string |
| 88 | * The icon string. |
| 89 | */ |
| 90 | public function getIcon(): ?string; |
| 91 | |
| 92 | /** |
| 93 | * Determine if the Island plugin is applicable. |
| 94 | * |
| 95 | * @return bool |
| 96 | * TRUE if plugin is applicable, FALSE otherwise. |
| 97 | */ |
| 98 | public function isApplicable(): bool; |
| 99 | |
| 100 | /** |
| 101 | * Alter the renderable of the display builder instance. |
| 102 | * |
| 103 | * @param \Drupal\display_builder\InstanceInterface $instance |
| 104 | * Display builder instance. |
| 105 | * @param array $build |
| 106 | * The renderable to alter. |
| 107 | * |
| 108 | * @return array |
| 109 | * The altered renderable. |
| 110 | */ |
| 111 | public function alterRenderable(InstanceInterface $instance, array $build): array; |
| 112 | |
| 113 | } |