You are here

public function ConfigManager::getEntityTypeIdByName in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/lib/Drupal/Core/Config/ConfigManager.php \Drupal\Core\Config\ConfigManager::getEntityTypeIdByName()

Returns the entity type of a configuration object.

Parameters

string $name: The configuration object name.

Return value

string|null Either the entity type name, or NULL if none match.

Overrides ConfigManagerInterface::getEntityTypeIdByName

2 calls to ConfigManager::getEntityTypeIdByName()
ConfigManager::findConfigEntityDependentsAsEntities in core/lib/Drupal/Core/Config/ConfigManager.php
Finds config entities that are dependent on extensions or entities.
ConfigManager::loadConfigEntityByName in core/lib/Drupal/Core/Config/ConfigManager.php
Loads a configuration entity using the configuration name.

File

core/lib/Drupal/Core/Config/ConfigManager.php, line 104
Contains \Drupal\Core\Config\ConfigManager.

Class

ConfigManager
The ConfigManager provides helper functions for the configuration system.

Namespace

Drupal\Core\Config

Code

public function getEntityTypeIdByName($name) {
  $entities = array_filter($this->entityManager
    ->getDefinitions(), function (EntityTypeInterface $entity_type) use ($name) {
    return $entity_type instanceof ConfigEntityTypeInterface && ($config_prefix = $entity_type
      ->getConfigPrefix()) && strpos($name, $config_prefix . '.') === 0;
  });
  return key($entities);
}