Skip to content

_format parameter is ignored in twig render function #2653

@mqmtech

Description

@mqmtech

(In this example I've just added code to the AcmeDemoBundle to make it easier to reproduce):

Twig code added to AcmeDemoShopBundle:Demo:index.html.twig:
{% render 'AcmeDemoBundle:Demo:hello2' with {'_format' : 'otherformat'} %}

Controller code added to Acme\DemoBundle\Controller\DemoController:
/* @route("/hello2.{_format}", name="_demo_hello2", defaults={"_format" = "defaultformat"})

  • @template()
    */
    public function hello2Action($_format) {
    return array('_format' => $_format);
    }

When the Twig template calls the render function the _format parameter is ignored and the controller always see "html" instead 'otherformat' (specified in the render function).

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions