function TwigExtension::addAdditionalContext

Same name in other branches
  1. 11.x core/modules/sdc/src/Twig/TwigExtension.php \Drupal\sdc\Twig\TwigExtension::addAdditionalContext()

Appends additional context to the template based on the template id.

Parameters

array &$context: The context.

string $component_id: The component ID.

Throws

\Drupal\sdc\Exception\ComponentNotFoundException

File

core/modules/sdc/src/Twig/TwigExtension.php, line 69

Class

TwigExtension
The twig extension so Drupal can recognize the new code.

Namespace

Drupal\sdc\Twig

Code

public function addAdditionalContext(array &$context, string $component_id) : void {
    $context = $this->mergeAdditionalRenderContext($this->pluginManager
        ->find($component_id), $context);
}

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