Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
n/a
0 / 0
n/a
0 / 0
CRAP
n/a
0 / 0
1<?php
2
3declare(strict_types=1);
4
5namespace Drupal\display_builder;
6
7use Drupal\Component\Plugin\ConfigurableInterface;
8use Drupal\Component\Plugin\PluginInspectionInterface;
9use Drupal\Core\Form\FormStateInterface;
10use Drupal\Core\Plugin\ContainerFactoryPluginInterface;
11
12/**
13 * Interface for island plugins.
14 */
15interface 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}