09a5e867388f2c86fd70596e44d8367d48da887e
[yaffs-website] / web / modules / contrib / entity_browser / src / EntityBrowserInterface.php
1 <?php
2
3 namespace Drupal\entity_browser;
4
5 use Drupal\Core\Config\Entity\ConfigEntityInterface;
6
7 /**
8  * Provides an interface defining an entity browser entity.
9  */
10 interface EntityBrowserInterface extends ConfigEntityInterface {
11
12   /**
13    * Gets the entity browser name.
14    *
15    * @return string
16    *   The name of the entity browser.
17    */
18   public function getName();
19
20   /**
21    * Sets the name of the entity browser.
22    *
23    * @param string $name
24    *   The name of the entity browser.
25    *
26    * @return \Drupal\entity_browser\EntityBrowserInterface
27    *   The class instance this method is called on.
28    */
29   public function setName($name);
30
31   /**
32    * Sets the label of the entity browser.
33    *
34    * @param string $label
35    *   The label of the entity browser.
36    *
37    * @return \Drupal\entity_browser\EntityBrowserInterface
38    *   The class instance this method is called on.
39    */
40   public function setLabel($label);
41
42   /**
43    * Sets the id of the display plugin.
44    *
45    * @param string $display
46    *   The id of the display plugin.
47    *
48    * @return \Drupal\entity_browser\EntityBrowserInterface
49    *   The class instance this method is called on.
50    */
51   public function setDisplay($display);
52
53   /**
54    * Sets the id of the widget selector plugin.
55    *
56    * @param string $display
57    *   The id of the widget selector plugin.
58    *
59    * @return \Drupal\entity_browser\EntityBrowserInterface
60    *   The class instance this method is called on.
61    */
62   public function setWidgetSelector($widget_selector);
63
64   /**
65    * Sets the id of the selection display plugin.
66    *
67    * @param string $display
68    *   The id of the selection display plugin.
69    *
70    * @return \Drupal\entity_browser\EntityBrowserInterface
71    *   The class instance this method is called on.
72    */
73   public function setSelectionDisplay($selection_display);
74
75   /**
76    * Returns the display.
77    *
78    * @return \Drupal\entity_browser\DisplayInterface
79    *   The display.
80    */
81   public function getDisplay();
82
83   /**
84    * Returns a specific widget.
85    *
86    * @param string $widget
87    *   The widget ID.
88    *
89    * @return \Drupal\entity_browser\WidgetInterface
90    *   The widget object.
91    */
92   public function getWidget($widget);
93
94   /**
95    * Returns the widgets for this entity browser.
96    *
97    * @return \Drupal\entity_browser\WidgetsLazyPluginCollection
98    *   The tag plugin bag.
99    */
100   public function getWidgets();
101
102   /**
103    * Saves a widget for this entity browser.
104    *
105    * @param array $configuration
106    *   An array of widget configuration.
107    *
108    * @return string
109    *   The widget ID.
110    */
111   public function addWidget(array $configuration);
112
113   /**
114    * Deletes a widget from this entity browser.
115    *
116    * @param \Drupal\entity_browser\WidgetInterface $widget
117    *   The widget object.
118    *
119    * @return $this
120    */
121   public function deleteWidget(WidgetInterface $widget);
122
123   /**
124    * Gets first widget based on weights.
125    *
126    * @return string|null
127    *   First widget instance ID or NULL if no widgets are available.
128    */
129   public function getFirstWidget();
130
131   /**
132    * Adds paramterers that will be passed to the widget.
133    *
134    * @param array $parameters
135    *   An array of parameters.
136    *
137    * @return $this
138    */
139   public function addAdditionalWidgetParameters(array $parameters);
140
141   /**
142    * Gets additional parameters that will be passed to the widget.
143    *
144    * @return array
145    *   Array of parameters.
146    */
147   public function getAdditionalWidgetParameters();
148
149   /**
150    * Returns the selection display.
151    *
152    * @return \Drupal\entity_browser\SelectionDisplayInterface
153    *   The display.
154    */
155   public function getSelectionDisplay();
156
157   /**
158    * Returns the widget selector.
159    *
160    * @return \Drupal\entity_browser\WidgetSelectorInterface
161    *   The widget selector.
162    */
163   public function getWidgetSelector();
164
165   /**
166    * Gets route that matches this display.
167    *
168    * @return \Symfony\Component\Routing\Route|bool
169    *   Route object or FALSE if no route is used.
170    */
171   public function route();
172
173   /**
174    * Gets entity browser form object.
175    *
176    * @return \Drupal\entity_browser\EntityBrowserFormInterface
177    *   Entity browser form.
178    */
179   public function getFormObject();
180
181 }