function ComponentLoader::getCacheKey

Same name in other branches
  1. 10 core/lib/Drupal/Core/Template/Loader/ComponentLoader.php \Drupal\Core\Template\Loader\ComponentLoader::getCacheKey()

File

core/lib/Drupal/Core/Template/Loader/ComponentLoader.php, line 100

Class

ComponentLoader
Lets you load templates using the component ID.

Namespace

Drupal\Core\Template\Loader

Code

public function getCacheKey($name) : string {
    try {
        $component = $this->pluginManager
            ->find($name);
    } catch (ComponentNotFoundException) {
        throw new LoaderError('Unable to find component');
    }
    return implode('--', array_filter([
        'components',
        $name,
        $component->getPluginDefinition()['provider'] ?? '',
    ]));
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.