Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. ComponentLoader.php

function ComponentLoader::getCacheKey

Overrides LoaderInterface::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'] ?? '',
    ]));
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal