I have created a twig file in sonata admin, where I want to show the preview of the another twig created using the sonata cms.
I found the use of render method to embed the controller action.
<div class="preview">
{{ render(controller('Bundle:Controller:action') }}
</div>
But the action takes an argument $contentDocument
public function Action($contentDocument, Request $request)
{
}
So how do I render this twig inside the preview div, to show a thumbnail to the user. Thank you
您可以将参数作为第二个参数传递给controller()树枝函数:{{render(controller('Bundle:Controller:action',{'contentDocument':some_instance_of_a_content_document})}}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.