function AttributeClassDiscovery::getProviderFromNamespace
Same name in other branches
- 10 core/lib/Drupal/Core/Plugin/Discovery/AttributeClassDiscovery.php \Drupal\Core\Plugin\Discovery\AttributeClassDiscovery::getProviderFromNamespace()
Extracts the provider name from a Drupal namespace.
Parameters
string $namespace: The namespace to extract the provider from.
Return value
string|null The matching provider name, or NULL otherwise.
2 calls to AttributeClassDiscovery::getProviderFromNamespace()
- AttributeClassDiscovery::prepareAttributeDefinition in core/
lib/ Drupal/ Core/ Plugin/ Discovery/ AttributeClassDiscovery.php - AttributeDiscoveryWithAnnotations::prepareAnnotationDefinition in core/
lib/ Drupal/ Core/ Plugin/ Discovery/ AttributeDiscoveryWithAnnotations.php - Prepares the annotation definition.
File
-
core/
lib/ Drupal/ Core/ Plugin/ Discovery/ AttributeClassDiscovery.php, line 82
Class
- AttributeClassDiscovery
- Defines a discovery mechanism to find plugins using attributes.
Namespace
Drupal\Core\Plugin\DiscoveryCode
protected function getProviderFromNamespace(string $namespace) : ?string {
preg_match('|^Drupal\\\\(?<provider>[\\w]+)\\\\|', $namespace, $matches);
if (isset($matches['provider'])) {
return mb_strtolower($matches['provider']);
}
return NULL;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.