TwigNodeTrans example

if ('plural' === $stream->next()->getValue()) {
        $count = $this->parser->getExpressionParser()->parseExpression();
        $stream->expect(Token::BLOCK_END_TYPE);
        $plural = $this->parser->subparse([$this, 'decideForEnd'], TRUE);
      }
    }

    $stream->expect(Token::BLOCK_END_TYPE);

    $this->checkTransString($body$lineno);

    $node = new TwigNodeTrans($body$plural$count$options$lineno$this->getTag());

    return $node;
  }

  /** * Detect a 'plural' switch or the end of a 'trans' tag. */
  public function decideForFork($token) {
    return $token->test(['plural', 'endtrans']);
  }

  
Home | Imprint | This part of the site doesn't use cookies.