public static function SchedulerModerationWidget::validateElement in Scheduler content moderation integration 8
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
- src/
Plugin/ Field/ FieldWidget/ SchedulerModerationWidget.php, line 93
Class
- SchedulerModerationWidget
- Plugin implementation of the 'scheduler moderation' widget.
Namespace
Drupal\scheduler_content_moderation_integration\Plugin\Field\FieldWidgetCode
public static function validateElement(array $element, FormStateInterface $form_state) {
if (is_array($element['#value'])) {
$value = current($element['#value']);
}
else {
$value = $element['#value'];
}
$form_state
->setValueForElement($element, [
$element['#key_column'] => $value,
]);
}