function ModerationStateWidget::__construct

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

Constructs a new ModerationStateWidget object.

Parameters

string $plugin_id: Plugin id.

mixed $plugin_definition: Plugin definition.

\Drupal\Core\Field\FieldDefinitionInterface $field_definition: Field definition.

array $settings: Field settings.

array $third_party_settings: Third party settings.

\Drupal\Core\Session\AccountInterface $current_user: Current user service.

\Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager: Entity type manager.

\Drupal\content_moderation\ModerationInformation $moderation_information: Moderation information service.

\Drupal\content_moderation\StateTransitionValidationInterface $validator: Moderation state transition validation service.

Overrides OptionsWidgetBase::__construct

File

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

Class

ModerationStateWidget
Plugin implementation of the 'moderation_state_default' widget.

Namespace

Drupal\content_moderation\Plugin\Field\FieldWidget

Code

public function __construct($plugin_id, $plugin_definition, FieldDefinitionInterface $field_definition, array $settings, array $third_party_settings, AccountInterface $current_user, EntityTypeManagerInterface $entity_type_manager, ModerationInformation $moderation_information, StateTransitionValidationInterface $validator) {
    parent::__construct($plugin_id, $plugin_definition, $field_definition, $settings, $third_party_settings);
    $this->entityTypeManager = $entity_type_manager;
    $this->currentUser = $current_user;
    $this->moderationInformation = $moderation_information;
    $this->validator = $validator;
}

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