You are here

public function ContentModeration::addEntityTypeAndBundle in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/content_moderation/src/Plugin/WorkflowType/ContentModeration.php \Drupal\content_moderation\Plugin\WorkflowType\ContentModeration::addEntityTypeAndBundle()

Add an entity type ID / bundle ID to the workflow.

Parameters

string $entity_type_id: The entity type ID to add. It is responsibility of the caller to provide a valid entity type ID.

string $bundle_id: The bundle ID to add. It is responsibility of the caller to provide a valid bundle ID.

Overrides ContentModerationInterface::addEntityTypeAndBundle

File

core/modules/content_moderation/src/Plugin/WorkflowType/ContentModeration.php, line 182

Class

ContentModeration
Attaches workflows to content entity types and their bundles.

Namespace

Drupal\content_moderation\Plugin\WorkflowType

Code

public function addEntityTypeAndBundle($entity_type_id, $bundle_id) {
  if (!$this
    ->appliesToEntityTypeAndBundle($entity_type_id, $bundle_id)) {
    $this->configuration['entity_types'][$entity_type_id][] = $bundle_id;
    sort($this->configuration['entity_types'][$entity_type_id]);
    ksort($this->configuration['entity_types']);
  }
}