2

Over a template I do a render method:

 {% set someString = "non-default" %}

{{ render(controller('AppBundle:Widgets:myCapsWidget'),{'somestring':someString})  }}

Over the controller I have the following method:

public function myCapsWidgetAction()
{
  //@todo: access the passing parameter
}

My problem is how can I access the somestring parameter? I tried to do

public function myCapsWidgetAction($somestring="default")
{
  return new Response(strtoupper($somestring));
}

Then via xdebug I noticed that the passed parameter was default instead of non-default.

I also looked over theese links:

But still no light in my path.

0

1 Answer 1

1

According to Symfony Twig {{render}} handling passed arguments

You should render the widget like:

{{ render(controller('AppBundle:Widgets:myCapsWidget',{'somestring':someString})  }}

Look on how the argument are being passed over the controller method

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.