function DirectoryWithMetadataDiscovery::getIdentifier
Same name in this branch
- 10 core/modules/sdc/src/Plugin/Discovery/DirectoryWithMetadataDiscovery.php \Drupal\sdc\Plugin\Discovery\DirectoryWithMetadataDiscovery::getIdentifier()
Same name in other branches
- 11.x core/modules/sdc/src/Plugin/Discovery/DirectoryWithMetadataDiscovery.php \Drupal\sdc\Plugin\Discovery\DirectoryWithMetadataDiscovery::getIdentifier()
- 11.x core/lib/Drupal/Core/Plugin/Discovery/DirectoryWithMetadataDiscovery.php \Drupal\Core\Plugin\Discovery\DirectoryWithMetadataDiscovery::getIdentifier()
The IDs can collide in two different scenarios:
1. Because one component is overriding another one via "weight". 2. Because the same component exists in different themes.
Overrides YamlDirectoryDiscovery::getIdentifier
File
-
core/
lib/ Drupal/ Core/ Plugin/ Discovery/ DirectoryWithMetadataDiscovery.php, line 64
Class
- DirectoryWithMetadataDiscovery
- Does the actual finding of the directories with metadata files.
Namespace
Drupal\Core\Plugin\DiscoveryCode
protected function getIdentifier($file, array $data) : string {
$id = $this->fileSystem
->basename($file, '.component.yml');
$provider_paths = array_flip($this->directories);
$provider = $this->findProvider($file, $provider_paths);
// We use the provider to dedupe components because it does not make sense
// for a single provider to fork itself.
return sprintf('%s:%s', $provider, $id);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.