-
Notifications
You must be signed in to change notification settings - Fork 188
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
Deprecated getAttributes() #250
Comments
The templates being in KnpMenu always import macros in places using them, so they should not trigger this deprecation. This deprecation happens when you call a macro in a template while relying on an import statement done in the parent template instead of importing them in your template. |
Sorry @stof I got lost. What is the proposed solution? Should I redefine the macro in my template or what else? |
no, you should not define the macro. you should import the macro (instead of relying on the implementation detail exposing you the macro imported by the parent template in some cases) |
Well, maybe I need to to give more details on my template. Here it is: {% extends 'knp_menu.html.twig' %}
{% block item %}
{% import "knp_menu.html.twig" as macros %}
<li{{ macros.attributes(attributes) }}></li>
{% endblock %} What should I do? |
Well, I resolved removing |
@garak I did experience the same issue. If you're using overwritten KNP menu templates it's highly possible that you overwrite more than one block. As the macros are being used in several blocks, you need to import the macros ( I'm overwriting the |
Closing this issue is not in KnpMenu and the solution for people's template is nicely explained by @sgehrig |
Fixing deprecated issues KnpLabs/KnpMenu#250
With last Twig version (1.28) I'm getting a deprecation warning:
this is the offending line in my
foo.html.twig
file:{{ macros.attributes(attributes) }} {# macros is from {%- import "knp_menu.html.twig" as macros -%} #}
The text was updated successfully, but these errors were encountered: