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

Breadcrumb

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

function ModuleNode::__construct

Parameters

BodyNode $body:

Overrides Node::__construct

File

vendor/twig/twig/src/Node/ModuleNode.php, line 36

Class

ModuleNode
Represents a module node.

Namespace

Twig\Node

Code

public function __construct(Node $body, ?AbstractExpression $parent, Node $blocks, Node $macros, Node $traits, $embeddedTemplates, Source $source) {
    if (!$body instanceof BodyNode) {
        trigger_deprecation('twig/twig', '3.12', \sprintf('Not passing a "%s" instance as the "body" argument of the "%s" constructor is deprecated.', BodyNode::class, static::class));
    }
    $nodes = [
        'body' => $body,
        'blocks' => $blocks,
        'macros' => $macros,
        'traits' => $traits,
        'display_start' => new Nodes(),
        'display_end' => new Nodes(),
        'constructor_start' => new Nodes(),
        'constructor_end' => new Nodes(),
        'class_end' => new Nodes(),
    ];
    if (null !== $parent) {
        $nodes['parent'] = $parent;
    }
    // embedded templates are set as attributes so that they are only visited once by the visitors
    parent::__construct($nodes, [
        'index' => null,
        'embedded_templates' => $embeddedTemplates,
    ], 1);
    // populate the template name of all node children
    $this->setSourceContext($source);
}
RSS feed
Powered by Drupal