| 1 |
<?php |
| 2 |
|
| 3 |
/* |
| 4 |
* This file is part of Twig. |
| 5 |
* |
| 6 |
* (c) Fabien Potencier |
| 7 |
* (c) Armin Ronacher |
| 8 |
* |
| 9 |
* For the full copyright and license information, please view the LICENSE |
| 10 |
* file that was distributed with this source code. |
| 11 |
*/ |
| 12 |
namespace ElementorDeps\Twig\Node\Expression; |
| 13 |
|
| 14 |
use ElementorDeps\Twig\Compiler; |
| 15 |
/** |
| 16 |
* Represents a parent node. |
| 17 |
* |
| 18 |
* @author Fabien Potencier <fabien@symfony.com> |
| 19 |
*/ |
| 20 |
class ParentExpression extends AbstractExpression |
| 21 |
{ |
| 22 |
public function __construct(string $name, int $lineno, ?string $tag = null) |
| 23 |
{ |
| 24 |
parent::__construct([], ['output' => \false, 'name' => $name], $lineno, $tag); |
| 25 |
} |
| 26 |
public function compile(Compiler $compiler) : void |
| 27 |
{ |
| 28 |
if ($this->getAttribute('output')) { |
| 29 |
$compiler->addDebugInfo($this)->write('yield from $this->yieldParentBlock(')->string($this->getAttribute('name'))->raw(", \$context, \$blocks);\n"); |
| 30 |
} else { |
| 31 |
$compiler->raw('$this->renderParentBlock(')->string($this->getAttribute('name'))->raw(', $context, $blocks)'); |
| 32 |
} |
| 33 |
} |
| 34 |
} |
| 35 |
|