@@ 8-35 (lines=28) @@ | ||
5 | /** |
|
6 | * Class CenterNode. |
|
7 | */ |
|
8 | class CenterNode extends BaseNode |
|
9 | { |
|
10 | /** |
|
11 | * @param \Twig_Compiler $compiler |
|
12 | */ |
|
13 | public function compile(\Twig_Compiler $compiler) |
|
14 | { |
|
15 | $compiler->addDebugInfo($this) |
|
16 | ->write(self::CODE_FIX_CONTEXT) |
|
17 | ->write(self::CODE_INSTANCE.'->startAlignment(\'center\');'.PHP_EOL) |
|
18 | ->write("ob_start();\n") |
|
19 | ->subcompile($this->getNode('body')) |
|
20 | ->write('$centerValue = trim(ob_get_clean());'.PHP_EOL) |
|
21 | ->write(self::CODE_INSTANCE.'->endAlignment($centerValue);'.PHP_EOL) |
|
22 | ->write('unset($centerValue);'.PHP_EOL); |
|
23 | } |
|
24 | ||
25 | /** |
|
26 | * @return string[] |
|
27 | */ |
|
28 | public function getAllowedParents(): array |
|
29 | { |
|
30 | return [ |
|
31 | FooterNode::class, |
|
32 | HeaderNode::class, |
|
33 | ]; |
|
34 | } |
|
35 | } |
|
36 |
@@ 8-35 (lines=28) @@ | ||
5 | /** |
|
6 | * Class LeftNode. |
|
7 | */ |
|
8 | class LeftNode extends BaseNode |
|
9 | { |
|
10 | /** |
|
11 | * @param \Twig_Compiler $compiler |
|
12 | */ |
|
13 | public function compile(\Twig_Compiler $compiler) |
|
14 | { |
|
15 | $compiler->addDebugInfo($this) |
|
16 | ->write(self::CODE_FIX_CONTEXT) |
|
17 | ->write(self::CODE_INSTANCE.'->startAlignment(\'left\');'.PHP_EOL) |
|
18 | ->write("ob_start();\n") |
|
19 | ->subcompile($this->getNode('body')) |
|
20 | ->write('$leftValue = trim(ob_get_clean());'.PHP_EOL) |
|
21 | ->write(self::CODE_INSTANCE.'->endAlignment($leftValue);'.PHP_EOL) |
|
22 | ->write('unset($leftValue);'.PHP_EOL); |
|
23 | } |
|
24 | ||
25 | /** |
|
26 | * @return string[] |
|
27 | */ |
|
28 | public function getAllowedParents(): array |
|
29 | { |
|
30 | return [ |
|
31 | FooterNode::class, |
|
32 | HeaderNode::class, |
|
33 | ]; |
|
34 | } |
|
35 | } |
|
36 |
@@ 8-35 (lines=28) @@ | ||
5 | /** |
|
6 | * Class RightNode. |
|
7 | */ |
|
8 | class RightNode extends BaseNode |
|
9 | { |
|
10 | /** |
|
11 | * @param \Twig_Compiler $compiler |
|
12 | */ |
|
13 | public function compile(\Twig_Compiler $compiler) |
|
14 | { |
|
15 | $compiler->addDebugInfo($this) |
|
16 | ->write(self::CODE_FIX_CONTEXT) |
|
17 | ->write(self::CODE_INSTANCE.'->startAlignment(\'right\');'.PHP_EOL) |
|
18 | ->write("ob_start();\n") |
|
19 | ->subcompile($this->getNode('body')) |
|
20 | ->write('$rightValue = trim(ob_get_clean());'.PHP_EOL) |
|
21 | ->write(self::CODE_INSTANCE.'->endAlignment($rightValue);'.PHP_EOL) |
|
22 | ->write('unset($rightValue);'.PHP_EOL); |
|
23 | } |
|
24 | ||
25 | /** |
|
26 | * @return string[] |
|
27 | */ |
|
28 | public function getAllowedParents(): array |
|
29 | { |
|
30 | return [ |
|
31 | FooterNode::class, |
|
32 | HeaderNode::class, |
|
33 | ]; |
|
34 | } |
|
35 | } |
|
36 |