function Debug::getContextVariables

Same name in other branches
  1. 5.x src/Twig/Extension/Debug.php \Drupal\devel\Twig\Extension\Debug::getContextVariables()

Filters the Twig context variable.

Parameters

array $context: The Twig context.

Return value

array An array Twig context variables.

2 calls to Debug::getContextVariables()
Debug::doDump in src/Twig/Extension/Debug.php
Debug::message in src/Twig/Extension/Debug.php
Provides debug function to Twig templates.

File

src/Twig/Extension/Debug.php, line 226

Class

Debug
Provides the Devel debugging function within Twig templates.

Namespace

Drupal\devel\Twig\Extension

Code

protected function getContextVariables(array $context) {
    $context_variables = [];
    foreach ($context as $key => $value) {
        if (!$value instanceof \Twig_Template) {
            $context_variables[$key] = $value;
        }
    }
    return $context_variables;
}