function ModerationStateWidget::calculateDependencies

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

Overrides PluginSettingsBase::calculateDependencies

File

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

Class

ModerationStateWidget
Plugin implementation of the 'moderation_state_default' widget.

Namespace

Drupal\content_moderation\Plugin\Field\FieldWidget

Code

public function calculateDependencies() {
    $dependencies = parent::calculateDependencies();
    if ($workflow = $this->moderationInformation
        ->getWorkflowForEntityTypeAndBundle($this->fieldDefinition
        ->getTargetEntityTypeId(), $this->fieldDefinition
        ->getTargetBundle())) {
        $dependencies[$workflow->getConfigDependencyKey()][] = $workflow->getConfigDependencyName();
    }
    return $dependencies;
}

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