Returns the entity type of a configuration object.
string $name: The configuration object name.
string|null Either the entity type name, or NULL if none match.
function config_get_entity_type_by_name($name) {
$entities = array_filter(entity_get_info(), function ($entity_info) use ($name) {
return isset($entity_info['config_prefix']) && strpos($name, $entity_info['config_prefix'] . '.') === 0;
});
return key($entities);
}