You are here

public function ContentModeration::removeEntityTypeAndBundle in Drupal 10

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

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]);
    }
  }
}