What are the Slack Archives?
It’s a history of our time together in the Slack Community! There’s a ton of knowledge in here, so feel free to search through the archives for a possible answer to your question.
Because this space is not active, you won’t be able to create a new post or comment here. If you have a question or want to start a discussion about something, head over to our categories and pick one to post in! You can always refer back to a post from Slack Archives if needed; just copy the link to use it as a reference..
Hi all, we are experiencing some issues with shop-ui release (v1.54.0).
Hi all, we are experiencing some issues with shop-ui release (v1.54.0).
https://github.com/spryker-shop/shop-ui/compare/1.53.1...1.54.0
We are unable to modify the “isVisible” property of the defined data object in an inherit template. “data.isVisible” keeps always true. Any ideas?{% extends template('widget') %}
{% define data = {
isVisible: false,
} %}
{% block template %}
{{ dump(data.isVisible) }} {# shows true, should be false #}
{% endblock body %}
Comments
-
@UN6T8SEM7 maybe or @U019DLP9S1F
thanks for your support in advance.0 -
Hi Marcel!
Can it be an issue with{% endblock body %}
? Should be{% endblock %}
.0 -
it was a wrong copy & paste.. i noted me too..
0 -
So you are using it in widget, correct? Or it’s a general issue for widgets/templates/components?
0 -
In widget.. I send u the example of your project.. (Marcel is just my colleague)
0 -
{% extends template('widget') %} {% define data = { isVisible: _widget.isVisible, punchoutDocumentTransferRequestForm: _widget.punchoutDocumentTransferRequestForm, textButton: 'punchout.transfer.ids-button' | trans, } %} {% block body %} {% if data.punchoutDocumentTransferRequestForm is not null %} {% include molecule('form') with { class: 'col spacing-x spacing-x--inner spacing-x--small spacing-y--big', modifiers: ['custom'], data: { form: data.punchoutDocumentTransferRequestForm, options: { action: path('punchout/ids/document/transfer'), attr: { novalidate: 'novalidate', }, }, submit: { enable: true, icon: 'swap_horiz', text: data.textButton, class: 'spacing-bottom button button--expand button--hollow button--icon', } } } only %} {% endif %} {% endblock %}
_widget.isVisible is correctly set to false, but body is displayed because data.isVisible is true, even if we overwrite it in define data...
0 -
I suppose only in widget.. we discovered only there at the moment the problem and for this widget template that i posted
0 -
as u see i just made another check
{% if data.punchoutDocumentTransferRequestForm is not null %}
to show or not the body.. because isVisible is always true..0 -
Really strange. It’s working for me from first point of view.
0 -
did u tried an example in your project locally?
0 -
Hey @UN6T8SEM7, this seems to be not an issue in connection with the noted shop-ui release.
Is it possible that the "define" Twig Tag is only manipulatable via include or embedding and not via inheritance?
https://documentation.spryker.com/docs/tutorial-how-define-twig-tag-is-working
0 -
Nope, the object which is created with define can be changed in extended template.
0 -
You are right, i've checked. We can also overwrite variables in extended templates. The only exception seems to be variables defined in this file
vendor/spryker-shop/shop-ui/src/SprykerShop/Yves/ShopUi/Theme/default/models/template.twig
https://github.com/spryker-shop/shop-ui/blob/68c1f61e8bf012310b2c50bb05b2ff1ceb8666a2/src/SprykerShop/Yves/ShopUi/Theme/default/models/template.twig0 -
Were you able to explicitly overwrite the
isVisible
Variable?0 -
In several places:
• https://github.com/spryker-shop/company-widget/blob/master/src/SprykerShop/Yves/Co[…]lt/views/menu-item-company-widget/menu-item-company-widget.twig
• https://github.com/spryker-shop/quote-request-widget/blob/master/src/SprykerShop/Y[…]me/default/views/quote-request-create/quote-request-create.twig
And several more0 -
Thanks for your examples!
These widgets are both inside a component (based oncomponent.twig
).
If you place your Widgets directly in a view (based ontemplate.twig
), for examplepage-layout-main.twig
it is not possible to overwriteisVisible
. Whatever you will define in your widget constructor or template, it will be alwaystrue
,0 -
Hmmm… sounds really strange. Thanks for this info. I’ll create a bug for it, so we can check what is wrong.
0
Categories
- All Categories
- 42 Getting Started & Guidelines
- 7 Getting Started in the Community
- 8 Additional Resources
- 7 Community Ideas and Feedback
- 76 Spryker News
- 929 Developer Corner
- 787 Spryker Development
- 89 Spryker Dev Environment
- 362 Spryker Releases
- 3 Oryx frontend framework
- 35 Propel ORM
- 68 Community Projects
- 3 Community Ideation Board
- 30 Hackathon
- 3 PHP Bridge
- 6 Gacela Project
- 26 Job Opportunities
- 3.2K 📜 Slack Archives
- 116 Academy
- 5 Business Users
- 370 Docker
- 551 Slack General
- 2K Help
- 75 Knowledge Sharing
- 6 Random Stuff
- 4 Code Testing
- 32 Product & Business Questions
- 70 Spryker Safari Questions
- 50 Random