37 $tokens = $this->twig->tokenize($resource->
getContent(), (
string) $resource);
38 $nodes = $this->twig->parse($tokens);
41 $this->logger->error(sprintf(
'The template "%s" contains an error: %s', $resource, $e->getMessage()));
62 $formulae[$node->getAttribute(
'name')] =
array(
63 $node->getAttribute(
'inputs'),
64 $node->getAttribute(
'filters'),
66 'output' => $node->getAttribute(
'asset')->getTargetPath(),
67 'name' => $node->getAttribute(
'name'),
68 'debug' => $node->getAttribute(
'debug'),
69 'combine' => $node->getAttribute(
'combine'),
70 'vars' => $node->getAttribute(
'vars'),
74 $name = $node->getAttribute(
'name');
78 foreach ($node->getNode(
'arguments') as $argument) {
79 $arguments[] = eval(
'return '.$this->twig->compile($argument).
';');
82 $invoker = $this->twig->getExtension(
'assetic')->getFilterInvoker($name);
84 $inputs = isset($arguments[0]) ? (
array) $arguments[0] :
array();
85 $filters = $invoker->getFilters();
86 $options = array_replace($invoker->getOptions(), isset($arguments[1]) ? $arguments[1] :
array());
89 $options[
'name'] = $invoker->getFactory()->generateAssetName($inputs, $filters,
$options);
92 $formulae[
$options[
'name']] =
array($inputs, $filters, $options);
96 foreach ($node as $child) {
98 $formulae += $this->
loadNode($child);
102 if ($node->hasAttribute(
'embedded_templates')) {
103 foreach ($node->getAttribute(
'embedded_templates') as $child) {
104 $formulae += $this->
loadNode($child);
getContent()
Returns the content of the resource.
Add rich text string
The name of the decorator.
A resource is something formulae can be loaded from.
if(!is_array($argv)) $options
Create styles array
The data for the language used.
Describes a logger instance.