supportedOptions['filenameEelExpression'] = [ null, 'Callable which creates a filename from variables', 'string', true, ]; } else { throw new \RuntimeException('supported option could not be set', 1697552694); } } protected function getAttachmentName(): string { if ($this instanceof TemplateView) { $variables = $this->getRenderingContext()->getVariableProvider()->getAll(); } elseif (\property_exists($this, 'variables')) { $variables = $this->variables; } else { throw new \RuntimeException( 'No variables can be detected for this kind of view: ' . TypeHandling::getTypeForValue($this), 1697550214 ); } if (!\property_exists($this, 'options')) { throw new \RuntimeException('Your view options could not be found', 1697550440); } $expression = $this->options[$this->eelExpressionOptionKey]; 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(), ])); $this->emitFilenameEelExpressionContext($context); return (new CompilingEvaluator())->evaluate($expression, $context); } /** * @SuppressWarnings("unused") */ #[Flow\Signal] protected function emitFilenameEelExpressionContext(Context $context): void { } }