You are here

interface FieldStateInterface in Field States UI 8.2

Same name and namespace in other branches
  1. 8 src/FieldStateInterface.php \Drupal\field_states_ui\FieldStateInterface

Defines the interface for field states.

Hierarchy

Expanded class hierarchy of FieldStateInterface

All classes that implement FieldStateInterface

See also

\Drupal\field_states_ui\Annotation\FieldState

\Drupal\field_states_ui\FieldStateBase

\Drupal\field_states_ui\FieldStateManager

Plugin API

File

src/FieldStateInterface.php, line 17

Namespace

Drupal\field_states_ui
View source
interface FieldStateInterface extends PluginInspectionInterface, ConfigurableInterface {

  /**
   * Applies a field state to the field widget's form element.
   *
   * @param array $states
   *   An array to hold states.
   * @param \Drupal\Core\Form\FormStateInterface $form_state
   *   The current state of the form.
   * @param array $context
   *   An associative array containing the following key-value pairs:
   *   - form: The form structure to which widgets are being attached. This may
   *     be a full form structure, or a sub-element of a larger form.
   *   - widget: The widget plugin instance.
   *   - items: The field values, as a
   *     \Drupal\Core\Field\FieldItemListInterface object.
   *   - delta: The order of this item in the array of sub-elements (0, 1, n).
   *   - default: A boolean indicating whether the form is being shown as a
   *     dummy form to set default values.
   * @param array $element
   *   The field widget form element as constructed by hook_field_widget_form().
   * @param array $parents
   *   The parents array from the element.
   *
   * @see \Drupal\Core\Field\WidgetBase::formSingleElement()
   * @see hook_field_widget_form_alter()
   *
   * @return bool
   *   TRUE on success. FALSE if unable to calculate the field state.
   */
  public function applyState(array &$states, FormStateInterface $form_state, array $context, array $element, array $parents = NULL);

  /**
   * Returns a render array summarizing the configuration of the image effect.
   *
   * @return array
   *   A render array.
   */
  public function getSummary();

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

  /**
   * Returns the unique ID representing the field state.
   *
   * @return string
   *   The field state ID.
   */
  public function getUuid();

}

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
FieldStateInterface::applyState public function Applies a field state to the field widget's form element. 1
FieldStateInterface::getSummary public function Returns a render array summarizing the configuration of the image effect. 1
FieldStateInterface::getUuid public function Returns the unique ID representing the field state. 1
FieldStateInterface::label public function Returns the field state label. 1
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