You are here

class TwigNodeTheme in Components! 8

Represents a call to theme() as a Twig node.

Hierarchy

  • class \Drupal\components\Template\TwigNodeTheme extends \Drupal\components\Template\Twig_Node implements \Drupal\components\Template\Twig_NodeOutputInterface

Expanded class hierarchy of TwigNodeTheme

File

src/Template/TwigNodeTheme.php, line 8

Namespace

Drupal\components\Template
View source
class TwigNodeTheme extends \Twig_Node implements \Twig_NodeOutputInterface {
  public function __construct(\Twig_Node_Expression $theme, \Twig_Node_Expression $variables = NULL, $lineno, $tag = NULL) {
    parent::__construct([
      'theme' => $theme,
      'variables' => $variables,
    ], [], $lineno, $tag);
  }

  /**
   * Compiles the template.
   *
   * @param \Twig_Compiler $compiler
   *   The compiler.
   */
  public function compile(\Twig_Compiler $compiler) {
    $expression = new \Twig_Node_Expression_Function('theme', new \Twig_Node([
      $this
        ->getNode('theme'),
      $this
        ->getNode('variables'),
    ]), $this
      ->getLine());
    $compiler
      ->addDebugInfo($this)
      ->subcompile(new \Twig_Node_Print($expression, $this
      ->getLine()));
  }

}

Members

Namesort descending Modifiers Type Description Overrides
TwigNodeTheme::compile public function Compiles the template.
TwigNodeTheme::__construct public function