function ComponentLoader::getCacheKey

Same name and namespace in other branches
  1. 11.x 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 $e) {
    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.