Compare commits

..

2 commits

Author SHA1 Message Date
e5175e965f fixing a syntax error in code example
Some checks failed
ci/woodpecker/push/code-style Pipeline failed
ci/woodpecker/push/functional-tests Pipeline was successful
2023-11-09 16:32:28 +01:00
a09738ec83 allow trait consumers to use the prepared eel evaluator 2023-11-09 16:32:15 +01:00
2 changed files with 9 additions and 2 deletions

View file

@ -6,6 +6,7 @@ namespace DigiComp\AttachmentViewUtility;
use Neos\Eel\CompilingEvaluator;
use Neos\Eel\Context;
use Neos\Eel\EelEvaluatorInterface;
use Neos\Eel\Helper\ArrayHelper;
use Neos\Eel\Helper\StringHelper;
use Neos\Flow\Annotations as Flow;
@ -47,7 +48,13 @@ trait EelFilenameTrait
throw new \RuntimeException('Your view options could not be found', 1697550440);
}
$expression = $this->options[$this->eelExpressionOptionKey];
$context = new Context(\array_merge($variables, [
return $this->getEelResult($expression, $variables);
}
protected function getEelResult(string $expression, array $contextVariables)
{
$context = new Context(\array_merge($contextVariables, [
'Array' => new ArrayHelper(),
'String' => new StringHelper(),
'Translation' => new TranslationHelper(),

View file

@ -54,5 +54,5 @@ Views.yaml:
requestFilter: "isController('Default') && isAction('download')"
viewObjectName: "Acme\\Vendor\\SimpleAttachmentView"
options:
filenameEelExpression: "'hello-' + name + '.txt"
filenameEelExpression: "'hello-' + name + '.txt'"
```