Updated all the contrib modules to their latest versions.
[yaffs-website] / web / modules / contrib / entity_browser / src / WidgetInterface.php
1 <?php
2
3 namespace Drupal\entity_browser;
4
5 use Drupal\Component\Plugin\ConfigurablePluginInterface;
6 use Drupal\Component\Plugin\PluginInspectionInterface;
7 use Drupal\Core\Form\FormStateInterface;
8 use Drupal\Core\Plugin\PluginFormInterface;
9
10 /**
11  * Defines the interface for entity browser widgets.
12  *
13  * Entity browser widgets present a form for actually selecting entities in an
14  * entity browser. Once entities have been selected, they are delivered upstream
15  * to the entity browser's selection display plugin.
16  */
17 interface WidgetInterface extends PluginInspectionInterface, ConfigurablePluginInterface, PluginFormInterface {
18
19   /**
20    * Returns the widget id.
21    *
22    * @return string
23    *   The widget id.
24    */
25   public function id();
26
27   /**
28    * Returns the widget UUID.
29    *
30    * @return string
31    *   The widget UUID.
32    */
33   public function uuid();
34
35   /**
36    * Returns the widget label.
37    *
38    * @return string
39    *   The widget label.
40    */
41   public function label();
42
43   /**
44    * Sets the widget's label.
45    *
46    * @param string $label
47    *   New plugin label.
48    *
49    * @return \Drupal\entity_browser\WidgetInterface
50    *   This object.
51    */
52   public function setLabel($label);
53
54   /**
55    * Returns the widget's weight.
56    *
57    * @return int
58    *   Widget's weight.
59    */
60   public function getWeight();
61
62   /**
63    * Sets the widget's weight.
64    *
65    * @param int $weight
66    *   New plugin weight.
67    *
68    * @return \Drupal\entity_browser\WidgetInterface
69    *   This object.
70    */
71   public function setWeight($weight);
72
73   /**
74    * Returns widget form.
75    *
76    * @param array $original_form
77    *   Entire form bult up to this point. Form elements for widget should generally
78    *   not be added directly to it but returned from funciton as a separated
79    *   unit.
80    * @param \Drupal\Core\Form\FormStateInterface $form_state
81    *   Form state object.
82    * @param array $additional_widget_parameters
83    *   Additional parameters that we want to pass to the widget.
84    *
85    * @return array
86    *   Form structure.
87    */
88   public function getForm(array &$original_form, FormStateInterface $form_state, array $additional_widget_parameters);
89
90   /**
91    * Validates form.
92    *
93    * @param array $form
94    *   Form.
95    * @param \Drupal\Core\Form\FormStateInterface $form_state
96    *   Form state object.
97    */
98   public function validate(array &$form, FormStateInterface $form_state);
99
100   /**
101    * Submits form.
102    *
103    * @param array $element
104    *   Widget part of the form.
105    * @param array $form
106    *   Form.
107    * @param \Drupal\Core\Form\FormStateInterface $form_state
108    *   Form state object.
109    */
110   public function submit(array &$element, array &$form, FormStateInterface $form_state);
111
112   /**
113    * Returns if widget requires JS commands support by selection display.
114    *
115    * @return bool
116    *   True is auto selection is enabled and add/remove of entities will be done
117    *   over javascript events on selection display.
118    */
119   public function requiresJsCommands();
120
121   /**
122    * Defines if the widget is visible / accessible in a given context.
123    *
124    * @return \Drupal\Core\Access\AccessResultInterface
125    *   The access result.
126    */
127   public function access();
128
129 }