public ConfigManager::findConfigEntityDependentsAsEntities($type, array $names, ConfigDependencyManager $dependency_manager = NULL)
Finds config entities that are dependent on extensions or entities.
Parameters
string $type: The type of dependency being checked. Either 'module', 'theme', 'config' or 'content'.
array $names: The specific names to check. If $type equals 'module' or 'theme' then it should be a list of module names or theme names. In the case of 'config' or 'content' it should be a list of configuration dependency names.
Return value
\Drupal\Core\Config\Entity\ConfigEntityInterface[] An array of dependencies as configuration entities.
Overrides ConfigManagerInterface::findConfigEntityDependentsAsEntities
File
- core/lib/Drupal/Core/Config/ConfigManager.php, line 264
Class
- ConfigManager
- The ConfigManager provides helper functions for the configuration system.
Namespace
Drupal\Core\Config
Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | public function findConfigEntityDependentsAsEntities( $type , array $names , ConfigDependencyManager $dependency_manager = NULL) { $dependencies = $this ->findConfigEntityDependents( $type , $names , $dependency_manager ); $entities = array (); $definitions = $this ->entityManager->getDefinitions(); foreach ( $dependencies as $config_name => $dependency ) { // Group by entity type to efficient load entities using // \Drupal\Core\Entity\EntityStorageInterface::loadMultiple(). $entity_type_id = $this ->getEntityTypeIdByName( $config_name ); // It is possible that a non-configuration entity will be returned if a // simple configuration object has a UUID key. This would occur if the // dependents of the system module are calculated since system.site has // a UUID key. if ( $entity_type_id ) { $id = substr ( $config_name , strlen ( $definitions [ $entity_type_id ]->getConfigPrefix()) + 1); $entities [ $entity_type_id ][] = $id ; } } $entities_to_return = array (); foreach ( $entities as $entity_type_id => $entities_to_load ) { $storage = $this ->entityManager->getStorage( $entity_type_id ); // Remove the keys since there are potential ID clashes from different // configuration entity types. $entities_to_return = array_merge ( $entities_to_return , array_values ( $storage ->loadMultiple( $entities_to_load ))); } return $entities_to_return ; } |
Please login to continue.