Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Template var in render block code seems ignored #149

Closed
stefandoorn opened this issue Jun 15, 2018 · 3 comments · Fixed by #150
Closed

Template var in render block code seems ignored #149

stefandoorn opened this issue Jun 15, 2018 · 3 comments · Fixed by #150

Comments

@stefandoorn
Copy link
Contributor

{{ render(path('bitbag_sylius_cms_plugin_shop_block_render', {'code' : 'homepage_header_image', 'template' : '@App/Some/Template/_path.html.twig'})) }}

I have the impression the template variable here is ignored, looking in vendor/bitbag/cms-plugin/src/Controller/BlockController.php the resolver always returns me the default type for HTML, as I can't find any code that takes in account the template variable set.

        $blockTemplateResolver = $this->get('bitbag_sylius_cms_plugin.resolver.block_template');
        $template = $blockTemplateResolver->resolveTemplate($block);

Always results into: @BitBagSyliusCmsPlugin/Shop/Block/Show/htmlBlock.html.twig"

Currently using v1.2, as I'm on Sylius v1.0 at the moment.

@stefandoorn
Copy link
Contributor Author

Changing

$template = $blockTemplateResolver->resolveTemplate($block);

into

$template = $request->get('template') ?? $blockTemplateResolver->resolveTemplate($block);

Makes it work, not sure if that's the solution you want though, else I can PR it. Of course can also put it in the resolver, but that's just passing around variables in this case.

@patrick477
Copy link
Contributor

Indeed. It should be added. May I ask you to provide a valid PR? :)

@stefandoorn
Copy link
Contributor Author

As mentioned above or another solution?

stefandoorn added a commit to stefandoorn/SyliusCmsPlugin that referenced this issue Jun 15, 2018
patrick477 added a commit that referenced this issue Jun 15, 2018
Make use of user provided template for block rendering (fixes #149)
stefandoorn added a commit to stefandoorn/SyliusCmsPlugin that referenced this issue Jun 22, 2018
patrick477 added a commit that referenced this issue Jun 26, 2018
Make use of user provided template for block rendering if provided (fixes #149) to v1.2.3 branch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants