function ModerationStateWidget::form

Same name in other branches
  1. 9 core/modules/content_moderation/src/Plugin/Field/FieldWidget/ModerationStateWidget.php \Drupal\content_moderation\Plugin\Field\FieldWidget\ModerationStateWidget::form()
  2. 8.9.x core/modules/content_moderation/src/Plugin/Field/FieldWidget/ModerationStateWidget.php \Drupal\content_moderation\Plugin\Field\FieldWidget\ModerationStateWidget::form()
  3. 10 core/modules/content_moderation/src/Plugin/Field/FieldWidget/ModerationStateWidget.php \Drupal\content_moderation\Plugin\Field\FieldWidget\ModerationStateWidget::form()

Overrides WidgetBase::form

File

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

Class

ModerationStateWidget
Plugin implementation of the 'moderation_state_default' widget.

Namespace

Drupal\content_moderation\Plugin\Field\FieldWidget

Code

public function form(FieldItemListInterface $items, array &$form, FormStateInterface $form_state, $get_delta = NULL) {
    $entity = $items->getEntity();
    if (!$this->moderationInformation
        ->isModeratedEntity($entity)) {
        return [];
    }
    return parent::form($items, $form, $form_state, $get_delta);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.