Same name in other branches
  1. 8.x-2.x src/FieldStateInterface.php \Drupal\field_states_ui\FieldStateInterface

Defines the interface for field states.

Hierarchy

  • interface \Drupal\field_states_ui\FieldStateInterface extends \Drupal\Component\Plugin\PluginInspectionInterface \Drupal\Component\Plugin\ConfigurablePluginInterface

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, ConfigurablePluginInterface {
    
    /**
     * 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

Title Sort descending Modifiers Object type Summary Overrides
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