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

Breadcrumb

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

function ComponentsTwigExtension::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\Core\Render\Component\Exception\ComponentNotFoundException

File

core/lib/Drupal/Core/Template/ComponentsTwigExtension.php, line 60

Class

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

Namespace

Drupal\Core\Template

Code

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

API Navigation

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