84e156473262c331348d1dc1eaf375bc72c082f4
[yaffs-website] / SelectionDisplayInterface.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 selection displays.
12  *
13  * This plugin type is responsible for displaying the currently selected
14  * entities in an entity browser and delivering them upstream. The selections
15  * are displayed in a form which delivers the selected entities on submit.
16  */
17 interface SelectionDisplayInterface extends PluginInspectionInterface, ConfigurablePluginInterface, PluginFormInterface {
18
19   /**
20    * Returns the selection display label.
21    *
22    * @return string
23    *   The selection display label.
24    */
25   public function label();
26
27   /**
28    * Returns selection display form.
29    *
30    * @param array $original_form
31    *   Entire form built up to this point. Form elements for selection display
32    *   should generally not be added directly to it but returned from function
33    *   as a separated unit.
34    * @param \Drupal\Core\Form\FormStateInterface $form_state
35    *   Form state object.
36    *
37    * @return array
38    *   Form structure.
39    */
40   public function getForm(array &$original_form, FormStateInterface $form_state);
41
42   /**
43    * Validates form.
44    *
45    * @param array $form
46    *   Form.
47    * @param \Drupal\Core\Form\FormStateInterface $form_state
48    *   Form state object.
49    */
50   public function validate(array &$form, FormStateInterface $form_state);
51
52   /**
53    * Submits form.
54    *
55    * @param array $form
56    *   Form.
57    * @param \Drupal\Core\Form\FormStateInterface $form_state
58    *   Form state object.
59    */
60   public function submit(array &$form, FormStateInterface $form_state);
61
62   /**
63    * Check does selection display support preselection.
64    *
65    * If preselection is not allowed by entity browser selection display, then
66    * exception will be thrown.
67    *
68    * @throws \Drupal\Core\Config\ConfigException
69    */
70   public function checkPreselectionSupport();
71
72   /**
73    * Returns true if selection display supports selection over javascript.
74    *
75    * @return bool
76    *   True if javascript add/remove events are supported.
77    */
78   public function supportsJsCommands();
79
80 }