Revision 1852
Added by darkviper over 11 years ago
Sandbox.php | ||
---|---|---|
35 | 35 |
$body = $this->parser->subparse(array($this, 'decideBlockEnd'), true); |
36 | 36 |
$this->parser->getStream()->expect(Twig_Token::BLOCK_END_TYPE); |
37 | 37 |
|
38 |
// in a sandbox tag, only include tags are allowed |
|
39 |
if (!$body instanceof Twig_Node_Include) { |
|
40 |
foreach ($body as $node) { |
|
41 |
if ($node instanceof Twig_Node_Text && ctype_space($node->getAttribute('data'))) { |
|
42 |
continue; |
|
43 |
} |
|
44 |
|
|
45 |
if (!$node instanceof Twig_Node_Include) { |
|
46 |
throw new Twig_Error_Syntax('Only "include" tags are allowed within a "sandbox" section', $node->getLine(), $this->parser->getFilename()); |
|
47 |
} |
|
48 |
} |
|
49 |
} |
|
50 |
|
|
38 | 51 |
return new Twig_Node_Sandbox($body, $token->getLine(), $this->getTag()); |
39 | 52 |
} |
40 | 53 |
|
Also available in: Unified diff
updated Twig template engine to stable version 1.11.1 step2