3 namespace Drupal\entity_browser;
5 use Drupal\Component\Plugin\ConfigurablePluginInterface;
6 use Drupal\Component\Plugin\PluginInspectionInterface;
7 use Drupal\Core\Form\FormStateInterface;
8 use Drupal\Core\Plugin\PluginFormInterface;
11 * Defines the interface for entity browser widget selectors.
13 * This plugin type is responsible for providing ways for users to select the
14 * current widget used for selecting entities in an entity browser. For example,
15 * if the user wants to tab between widgets, the tab set will be created and
16 * managed by the widget selector.
18 interface WidgetSelectorInterface extends PluginInspectionInterface, ConfigurablePluginInterface, PluginFormInterface {
21 * Returns the widget selector label.
26 public function label();
29 * Returns widget selector form.
34 public function getForm(array &$form, FormStateInterface &$form_state);
37 * Sets the default widget.
39 * @param string $widget
40 * Id of widget to set as the current widget.
42 public function setDefaultWidget($widget);
49 * @param \Drupal\Core\Form\FormStateInterface $form_state
52 public function validate(array &$form, FormStateInterface $form_state);
59 * @param \Drupal\Core\Form\FormStateInterface $form_state
63 * The selected widget ID.
65 public function submit(array &$form, FormStateInterface $form_state);