function 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::findConfigEntityDependenciesAsEntities in core/
lib/ Drupal/ Core/ Config/ ConfigManager.php - ConfigManager::loadConfigEntityByName in core/
lib/ Drupal/ Core/ Config/ ConfigManager.php
File
-
core/
lib/ Drupal/ Core/ Config/ ConfigManager.php, line 121
Class
- ConfigManager
- The ConfigManager provides helper functions for the configuration system.
Namespace
Drupal\Core\ConfigCode
public function getEntityTypeIdByName($name) {
foreach ($this->entityTypeManager
->getDefinitions() as $entity_type_id => $entity_type) {
if ($entity_type instanceof ConfigEntityTypeInterface && ($config_prefix = $entity_type->getConfigPrefix()) && str_starts_with($name, $config_prefix . '.')) {
return $entity_type_id;
}
}
return NULL;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.