You are here

interface WidgetInterface in Entity Browser 8.2

Same name and namespace in other branches
  1. 8 src/WidgetInterface.php \Drupal\entity_browser\WidgetInterface

Defines the interface for entity browser widgets.

Entity browser widgets present a form for actually selecting entities in an entity browser. Once entities have been selected, they are delivered upstream to the entity browser's selection display plugin.

Hierarchy

Expanded class hierarchy of WidgetInterface

All classes that implement WidgetInterface

2 files declare their use of WidgetInterface
EntityBrowser.php in src/Entity/EntityBrowser.php
EntityBrowserTest.php in tests/src/Kernel/Extension/EntityBrowserTest.php

File

src/WidgetInterface.php, line 18

Namespace

Drupal\entity_browser
View source
interface WidgetInterface extends PluginInspectionInterface, ConfigurableInterface, PluginFormInterface, DependentPluginInterface {

  /**
   * Returns the widget id.
   *
   * @return string
   *   The widget id.
   */
  public function id();

  /**
   * Returns the widget UUID.
   *
   * @return string
   *   The widget UUID.
   */
  public function uuid();

  /**
   * Returns the widget label.
   *
   * @return string
   *   The widget label.
   */
  public function label();

  /**
   * Sets the widget's label.
   *
   * @param string $label
   *   New plugin label.
   *
   * @return \Drupal\entity_browser\WidgetInterface
   *   This object.
   */
  public function setLabel($label);

  /**
   * Returns the widget's weight.
   *
   * @return int
   *   Widget's weight.
   */
  public function getWeight();

  /**
   * Sets the widget's weight.
   *
   * @param int $weight
   *   New plugin weight.
   *
   * @return \Drupal\entity_browser\WidgetInterface
   *   This object.
   */
  public function setWeight($weight);

  /**
   * Returns widget form.
   *
   * @param array $original_form
   *   Entire form bult up to this point. Form elements for widget should generally
   *   not be added directly to it but returned from funciton as a separated
   *   unit.
   * @param \Drupal\Core\Form\FormStateInterface $form_state
   *   Form state object.
   * @param array $additional_widget_parameters
   *   Additional parameters that we want to pass to the widget.
   *
   * @return array
   *   Form structure.
   */
  public function getForm(array &$original_form, FormStateInterface $form_state, array $additional_widget_parameters);

  /**
   * Validates form.
   *
   * @param array $form
   *   Form.
   * @param \Drupal\Core\Form\FormStateInterface $form_state
   *   Form state object.
   */
  public function validate(array &$form, FormStateInterface $form_state);

  /**
   * Submits form.
   *
   * @param array $element
   *   Widget part of the form.
   * @param array $form
   *   Form.
   * @param \Drupal\Core\Form\FormStateInterface $form_state
   *   Form state object.
   */
  public function submit(array &$element, array &$form, FormStateInterface $form_state);

  /**
   * Returns if widget requires JS commands support by selection display.
   *
   * @return bool
   *   True is auto selection is enabled and add/remove of entities will be done
   *   over javascript events on selection display.
   */
  public function requiresJsCommands();

  /**
   * Defines if the widget is visible / accessible in a given context.
   *
   * @return \Drupal\Core\Access\AccessResultInterface
   *   The access result.
   */
  public function access();

}

Members

Namesort descending Modifiers Type Description Overrides
ConfigurableInterface::defaultConfiguration public function Gets default configuration for this plugin. 11
ConfigurableInterface::getConfiguration public function Gets this plugin's configuration. 12
ConfigurableInterface::setConfiguration public function Sets the configuration for this plugin instance. 12
DependentPluginInterface::calculateDependencies public function Calculates dependencies for the configured plugin. 19
PluginFormInterface::buildConfigurationForm public function Form constructor. 36
PluginFormInterface::submitConfigurationForm public function Form submission handler. 32
PluginFormInterface::validateConfigurationForm public function Form validation handler. 18
PluginInspectionInterface::getPluginDefinition public function Gets the definition of the plugin implementation. 4
PluginInspectionInterface::getPluginId public function Gets the plugin_id of the plugin instance. 2
WidgetInterface::access public function Defines if the widget is visible / accessible in a given context. 1
WidgetInterface::getForm public function Returns widget form. 1
WidgetInterface::getWeight public function Returns the widget's weight. 1
WidgetInterface::id public function Returns the widget id. 1
WidgetInterface::label public function Returns the widget label. 1
WidgetInterface::requiresJsCommands public function Returns if widget requires JS commands support by selection display. 1
WidgetInterface::setLabel public function Sets the widget's label. 1
WidgetInterface::setWeight public function Sets the widget's weight. 1
WidgetInterface::submit public function Submits form. 1
WidgetInterface::uuid public function Returns the widget UUID. 1
WidgetInterface::validate public function Validates form. 1