You are here

public static function ModerationStateWidget::validateElement in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/content_moderation/src/Plugin/Field/FieldWidget/ModerationStateWidget.php \Drupal\content_moderation\Plugin\Field\FieldWidget\ModerationStateWidget::validateElement()

Form validation handler for widget elements.

Parameters

array $element: The form element.

\Drupal\Core\Form\FormStateInterface $form_state: The form state.

Overrides OptionsWidgetBase::validateElement

File

core/modules/content_moderation/src/Plugin/Field/FieldWidget/ModerationStateWidget.php, line 186

Class

ModerationStateWidget
Plugin implementation of the 'moderation_state_default' widget.

Namespace

Drupal\content_moderation\Plugin\Field\FieldWidget

Code

public static function validateElement(array $element, FormStateInterface $form_state) {
  $form_state
    ->setValueForElement($element, [
    $element['state']['#key_column'] => $element['state']['#value'],
  ]);
}