public function FeaturesManager::getConfigType in Features 8.3
Same name and namespace in other branches
- 8.4 src/FeaturesManager.php \Drupal\features\FeaturesManager::getConfigType()
Returns the short name and type of a full config name.
Parameters
string $fullname: The full configuration name.
Return value
array 'type' => string the config type 'name_short' => string the short config name, without prefix.
Overrides FeaturesManagerInterface::getConfigType
File
- src/
FeaturesManager.php, line 210
Class
- FeaturesManager
- The FeaturesManager provides helper functions for building packages.
Namespace
Drupal\featuresCode
public function getConfigType($fullname) {
$result = [
'type' => '',
'name_short' => '',
];
$prefix = FeaturesManagerInterface::SYSTEM_SIMPLE_CONFIG . '.';
if (strpos($fullname, $prefix) !== FALSE) {
$result['type'] = FeaturesManagerInterface::SYSTEM_SIMPLE_CONFIG;
$result['name_short'] = substr($fullname, strlen($prefix));
}
else {
foreach ($this->entityTypeManager
->getDefinitions() as $entity_type => $definition) {
if ($definition
->entityClassImplements('Drupal\\Core\\Config\\Entity\\ConfigEntityInterface')) {
$prefix = $definition
->getConfigPrefix() . '.';
if (strpos($fullname, $prefix) === 0) {
$result['type'] = $entity_type;
$result['name_short'] = substr($fullname, strlen($prefix));
}
}
}
}
return $result;
}