Create href to presenter with array

Notice: This thread is very old.
cameroncz
Member | 1
+
0
-

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?

Casper
Member | 253
+
+1
-

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)

jiri.pudil
Nette Blogger | 1029
+
+1
-

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)
{
}