[beta1] Remove outdated "import _self as" tag

Created on 6 March 2023, over 1 year ago
Updated 14 March 2023, over 1 year ago

Problem/Motivation

We have some outdated Twig1 code:

templates/patterns/side_menu/pattern-side-menu.html.twig:{% import _self as menus %}
templates/patterns/side_menu/pattern-side-menu.html.twig:  {% import _self as menus %}
templates/patterns/nav_menu/pattern-nav-menu.html.twig:{% import _self as menus %}
templates/patterns/nav_menu/pattern-nav-menu.html.twig:  {% import _self as menus %}
templates/patterns/nav_menu/pattern-nav-menu.html.twig:  {% import _self as menus %}

Since Twig 2, it is not necessary to import explicitly _self in variable :

{% macro item(whatever) %}...{% endmacro %}
{% import _self as pagination %}
{{ pagination.item(whatever) }}

Because it is now possible to call a macro directly from _self:

{% macro item(whatever) %}...{% endmacro %}
{{ _self.item(whatever) }}

Source : https://twig.symfony.com/doc/2.x/tags/macro.html

Proposed resolution

Remove "import _self as" tags

API changes

None because:

πŸ“Œ Task
Status

Fixed

Version

1.0

Component

Code

Created by

πŸ‡«πŸ‡·France pdureau Paris

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.69.0 2024