Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

When using {{ render(controller(something))}} in twig, then request locale will not be passed to controller Request #28368

Copy link
Copy link
Closed
@otskarli

Description

@otskarli
Issue body actions

Symfony version(s) affected: 2.8 3.4

Description
when using {{ render(controller(something)) }} in twig, then request locale will not be passed to controller, it will always use defaultLocale, no matter what we define in configuration files.

Possible Solution
We just overwrite InlineFragmentRenderer

service:

fragment.renderer.inline:
        class: AppBundle\Twig\AppInlineFragmentRenderer
        arguments:
            - '@http_kernel'
            - '@event_dispatcher'
        calls:
            - [ setFragmentPath, ['%fragment.path%'] ]
        tags:
            - { name: kernel.fragment_renderer, alias: inline }

class:

class AppInlineFragmentRenderer extends InlineFragmentRenderer
{
    protected function createSubRequest($uri, Request $request)
    {
        /** @var Request $subRequest */
        if($subRequest = parent::createSubRequest($uri, $request)){
            $subRequest->setLocale($request->getLocale());
        }
        return $subRequest;
    }
}

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

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.