You are here

protected function Debug::getContextVariables in Devel 4.x

Same name and namespace in other branches
  1. 8.3 src/Twig/Extension/Debug.php \Drupal\devel\Twig\Extension\Debug::getContextVariables()
  2. 8 src/Twig/Extension/Debug.php \Drupal\devel\Twig\Extension\Debug::getContextVariables()
  3. 8.2 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 220

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;
}