4

How I can change my array value by string index in twig template? I'm trying:

{% do params['redirect_uri'] = 'http://site.loc/' %}

but I get nex error:

Unexpected token "operator" of value "=" ("end of statement block" expected) in
BWUserBundle:User/social:sign-in-thumbs.html.twig at line 4

I also trying:

{% set params['redirect_uri'] = 'http://site.loc/' %}

but have error too:

Unexpected token "punctuation" of value "[" ("end of statement block" expected) in 
BWUserBundle:User/social:sign-in-thumbs.html.twig at line 4

Any ideas?

Victor Bocharsky
  • 11,930
  • 13
  • 58
  • 91

1 Answers1

6

what about,

{% set params = params|merge({'redirect_uri': 'http://site.loc/'}) %}
Ahmed Siouani
  • 13,701
  • 12
  • 61
  • 72
  • 1
    `Unexpected token "punctuation" of value "." ("end of statement block" expected) in BWUserBundle:User/social:sign-in-thumbs.html.twig at line 4` – Victor Bocharsky Jan 14 '14 at 12:19