function TwigComponentLoader::getCacheKey

Same name in other branches
  1. 10 core/modules/sdc/src/Twig/TwigComponentLoader.php \Drupal\sdc\Twig\TwigComponentLoader::getCacheKey()

File

core/modules/sdc/src/Twig/TwigComponentLoader.php, line 102

Class

TwigComponentLoader
Lets you load templates using the component ID.

Namespace

Drupal\sdc\Twig

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([
        'sdc',
        $name,
        $component->getPluginDefinition()['provider'] ?? '',
    ]));
}

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