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

Feature Request: Twig {% switch %} #5364

Closed
steve-buri opened this issue Dec 3, 2019 · 3 comments

Comments

@steve-buri
Copy link

@steve-buri steve-buri commented Dec 3, 2019

Feature Request

Feature description

A switch equal to https://docs.craftcms.com/v2/templating/switch.html

If you currently use {% switch %} {% endswitch %} inside a custom area brick, you will receive the message "Unknown "switch" tag. Did you mean "with"?"

Steps to test the feature

Create a folder inside app/Ressources/views/Areas/test/> named view.html.twig
Create a file inside src/AppBundle/Document/Areabricknamed Test.php

Code example

<?php
// Test.php
namespace AppBundle\Document\Areabrick;

class Test extends AbstractAreabrick
{
    /**
     * {@inheritdoc}
     */
    public function getName()
    {
        return 'Test';
    }
}
{# app/Ressources/views/Areas/test/view.html.twig #}

{% set var = "text" %}
{% switch var %}
 {% case "text" %}
    <p>switch works!</p>
{% endswitch %}

Thanks in advance
Steve

@steve-buri steve-buri changed the title Feature Request: Twig {% switch }% Feature Request: Twig {% switch %} Dec 3, 2019
@dpfaffenbauer

This comment has been minimized.

Copy link
Contributor

@dpfaffenbauer dpfaffenbauer commented Dec 3, 2019

Switch is not a standard Twig Feature, if you want to have it, you can install custom bundles that add it for you.... I don't think that is a requirement Pimcore needs.

@steve-buri

This comment has been minimized.

Copy link
Author

@steve-buri steve-buri commented Dec 5, 2019

Would be nice to have, but yes. We will add in manually.
Thanks @dpfaffenbauer

@steve-buri steve-buri closed this Dec 5, 2019
@dpfaffenbauer

This comment has been minimized.

Copy link
Contributor

@dpfaffenbauer dpfaffenbauer commented Dec 5, 2019

separation of concerns is the key argument here ;) Thanks for your understanding.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.