Create href to presenter with array

Member | 1

Hey there,
I have a little problem, Im trying to create href from latte to presenter with array as argument, but nette says only scalars are available. Till now i was using
<a n:href="changeMain! market" .......> , but now i need send array instead of “market”, is there a way to go?

Member | 253

If you want to pass multiple arguments stored in array, use (expand) $args. See documentation.

{var $args = [$productId, lang => cs]}
<a n:href="Product:show (expand) $args">product detail</a>

Last edited by Casper (2014-12-30 16:09)

Member | 846

If you want to allow arrays, you have to provide a typehint for the parameter in the target method, e.g.:

public function handleChangeMain(array $market)