public static function ModerationStateWidget::updateStatus in Workbench Moderation 8
Same name and namespace in other branches
- 8.2 src/Plugin/Field/FieldWidget/ModerationStateWidget.php \Drupal\workbench_moderation\Plugin\Field\FieldWidget\ModerationStateWidget::updateStatus()
Entity builder updating the node moderation state with the submitted value.
Parameters
string $entity_type_id: The entity type identifier.
\Drupal\Core\Entity\ContentEntityInterface $entity: The entity updated with the submitted values.
array $form: The complete form array.
\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.
File
- src/
Plugin/ Field/ FieldWidget/ ModerationStateWidget.php, line 192
Class
- ModerationStateWidget
- Plugin implementation of the 'moderation_state_default' widget.
Namespace
Drupal\workbench_moderation\Plugin\Field\FieldWidgetCode
public static function updateStatus($entity_type_id, ContentEntityInterface $entity, array $form, FormStateInterface $form_state) {
$element = $form_state
->getTriggeringElement();
if (isset($element['#moderation_state'])) {
$entity->moderation_state->target_id = $element['#moderation_state'];
}
}