function ContentModeration::removeEntityTypeAndBundle

Same name and namespace in other branches
  1. 8.9.x core/modules/content_moderation/src/Plugin/WorkflowType/ContentModeration.php \Drupal\content_moderation\Plugin\WorkflowType\ContentModeration::removeEntityTypeAndBundle()
  2. 10 core/modules/content_moderation/src/Plugin/WorkflowType/ContentModeration.php \Drupal\content_moderation\Plugin\WorkflowType\ContentModeration::removeEntityTypeAndBundle()
  3. 11.x core/modules/content_moderation/src/Plugin/WorkflowType/ContentModeration.php \Drupal\content_moderation\Plugin\WorkflowType\ContentModeration::removeEntityTypeAndBundle()

Overrides ContentModerationInterface::removeEntityTypeAndBundle

1 call to ContentModeration::removeEntityTypeAndBundle()
ContentModeration::onDependencyRemoval in core/modules/content_moderation/src/Plugin/WorkflowType/ContentModeration.php
Informs the plugin that a dependency of the workflow will be deleted.

File

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

Class

ContentModeration
Attaches workflows to content entity types and their bundles.

Namespace

Drupal\content_moderation\Plugin\WorkflowType

Code

public function removeEntityTypeAndBundle($entity_type_id, $bundle_id) {
    if (!isset($this->configuration['entity_types'][$entity_type_id])) {
        return;
    }
    $key = array_search($bundle_id, $this->configuration['entity_types'][$entity_type_id], TRUE);
    if ($key !== FALSE) {
        unset($this->configuration['entity_types'][$entity_type_id][$key]);
        if (empty($this->configuration['entity_types'][$entity_type_id])) {
            unset($this->configuration['entity_types'][$entity_type_id]);
        }
        else {
            $this->configuration['entity_types'][$entity_type_id] = array_values($this->configuration['entity_types'][$entity_type_id]);
        }
    }
}

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