public function FeaturesManager::listConfigTypes in Features 8.4
Same name and namespace in other branches
- 8.3 src/FeaturesManager.php \Drupal\features\FeaturesManager::listConfigTypes()
Lists the types of configuration available on the site.
Parameters
bool $bundles_only: Whether to list only configuration types that provide bundles.
Return value
array An array with machine name keys and human readable values.
Overrides FeaturesManagerInterface::listConfigTypes
1 call to FeaturesManager::listConfigTypes()
- FeaturesManager::initConfigCollection in src/
FeaturesManager.php - Loads configuration from storage into a property.
File
- src/
FeaturesManager.php, line 1102
Class
- FeaturesManager
- The FeaturesManager provides helper functions for building packages.
Namespace
Drupal\featuresCode
public function listConfigTypes($bundles_only = FALSE) {
$definitions = [];
foreach ($this->entityTypeManager
->getDefinitions() as $entity_type => $definition) {
if ($definition
->entityClassImplements('Drupal\\Core\\Config\\Entity\\ConfigEntityInterface')) {
if (!$bundles_only || $definition
->getBundleOf()) {
$definitions[$entity_type] = $definition;
}
}
}
$entity_types = array_map(function (EntityTypeInterface $definition) {
return $definition
->getLabel();
}, $definitions);
// Sort the entity types by label, then add the simple config to the top.
uasort($entity_types, 'strnatcasecmp');
return $bundles_only ? $entity_types : [
FeaturesManagerInterface::SYSTEM_SIMPLE_CONFIG => $this
->t('Simple configuration'),
] + $entity_types;
}