class TwigNodeTrans extends Twig_Node (View source)

A class that defines the Twig 'trans' tag for Drupal.

This Twig extension was originally based on Twig i18n extension. It has been severely modified to work properly with the complexities of the Drupal translation system.

Methods

__construct(Twig_Node $body, Twig_Node $plural = NULL, Twig_Node_Expression $count = NULL, Twig_Node_Expression $options = NULL, $lineno, $tag = NULL)

{@inheritdoc}

compile(Twig_Compiler $compiler)

{@inheritdoc}

array
compileString(Twig_Node $body)

Extracts the text and tokens for the "trans" tag.

Details

__construct(Twig_Node $body, Twig_Node $plural = NULL, Twig_Node_Expression $count = NULL, Twig_Node_Expression $options = NULL, $lineno, $tag = NULL)

{@inheritdoc}

Parameters

Twig_Node $body
Twig_Node $plural
Twig_Node_Expression $count
Twig_Node_Expression $options
$lineno
$tag

compile(Twig_Compiler $compiler)

{@inheritdoc}

Parameters

Twig_Compiler $compiler

protected array compileString(Twig_Node $body)

Extracts the text and tokens for the "trans" tag.

Parameters

Twig_Node $body

The node to compile.

Return Value

array

Returns an array containing the two following parameters:

  • string $text The extracted text.
  • array $tokens The extracted tokens as new \Twig_Node_Expression_Name instances.