You are here

protected function ConfigImportSubscriber::getWorkflow in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/content_moderation/src/EventSubscriber/ConfigImportSubscriber.php \Drupal\content_moderation\EventSubscriber\ConfigImportSubscriber::getWorkflow()
  2. 9 core/modules/content_moderation/src/EventSubscriber/ConfigImportSubscriber.php \Drupal\content_moderation\EventSubscriber\ConfigImportSubscriber::getWorkflow()

Get the workflow entity object from the configuration name.

Parameters

string $config_name: The configuration object name.

Return value

\Drupal\workflows\WorkflowInterface|null A workflow entity object. NULL if no matching entity is found.

1 call to ConfigImportSubscriber::getWorkflow()
ConfigImportSubscriber::onConfigImporterValidate in core/modules/content_moderation/src/EventSubscriber/ConfigImportSubscriber.php
Checks that the configuration synchronization is valid.

File

core/modules/content_moderation/src/EventSubscriber/ConfigImportSubscriber.php, line 87

Class

ConfigImportSubscriber
Check moderation states are not being used before updating workflow config.

Namespace

Drupal\content_moderation\EventSubscriber

Code

protected function getWorkflow($config_name) {
  $entity_type_id = $this->configManager
    ->getEntityTypeIdByName($config_name);
  if ($entity_type_id !== 'workflow') {
    return;
  }

  /** @var \Drupal\Core\Config\Entity\ConfigEntityTypeInterface $entity_type */
  $entity_type = $this->entityTypeManager
    ->getDefinition($entity_type_id);
  $entity_id = ConfigEntityStorage::getIDFromConfigName($config_name, $entity_type
    ->getConfigPrefix());
  return $this->entityTypeManager
    ->getStorage($entity_type_id)
    ->load($entity_id);
}