Filter call inside of parameter in macro

dakur
Member | 493
+
0
-

Hi,

I use translations in my views as shown below and it would come handy if some general behavior (like obtaining account's name or gender from id) could be extracted to filters. I have no problem with this.

But the question for me is – is it possible with some syntax to transform variable with filter inside of the translation macro? If not, is it technically possible to implement it, or is there some technical limit (on syntax level probably)?

{_ 'ReadConfirmationPresenter.alreadyClosed.heading', [
	'managerName' => $closedBy|accountIdToUserName,
	'managerGender' => $closedBy|accountIdToGender,
	'closedPrematurely' => $closedPrematurely,
]}

Note: I know I can workaround it with {capture} like so, but that's not what I'm looking for, that doesn't make the code straighforward.

{capture $managerName}{$closedBy|accountIdToUserName}{/capture}
{_ '...', ['managerName' => $managerName]}

Thanks.

David Grudl
Nette Core | 8218
+
+5
-

Try this 'managerName' => ($closedBy|accountIdToUserName),

dakur
Member | 493
+
0
-

Brilliant!