diff --git a/resources/references/storefront-reference/twig-function-reference.md b/resources/references/storefront-reference/twig-function-reference.md index 88b1ef372..a1628f9bc 100644 --- a/resources/references/storefront-reference/twig-function-reference.md +++ b/resources/references/storefront-reference/twig-function-reference.md @@ -9,26 +9,36 @@ nav: In Shopware, we extend Twig's functionality by custom ones. See our own actions below. -::: warning -#### No official support for the twig \{\% use \%\} tag - -Try to avoid importing blocks from the core templates with the \{\% use \%\} tag for horizontal reuse in twig. [Twig documentation - use tag](https://twig.symfony.com/doc/3.x/tags/use.html). - -The \{\% use \%\} tag does not consider the template inheritance similar to \{\% sw_extends \%\}`. +::: info +Official support for complete Twig multi inheritance using sw_* equivalents available since 6.6.7.0 +::: -Furthermore, templates which are imported via \{\% use \%\} are not allowed to have additional twig statements outside of twig blocks. Therefore, changes in core templates which are imported via \{\% use \%\} might break your app or plugin. +::: warning +Templates which are imported via \{\% sw_use \%\} are not allowed to have additional twig statements outside of twig blocks. Therefore, changes in core templates which are imported via \{\% sw_use \%\} might break your app or plugin. ::: -## Functions +## Tags | Function | Description | Notes | | :--- | :--- | :--- | -| `sw_extends` | Inherits from another file with support for multi inheritance. The API is the same like in twigs default `extends` | --- | -| `sw_include` | Includes template partials with support for multi inheritance. The API is the same like in twigs default `include` | --- | +| `sw_extends` | Inherits from another file with support for multi inheritance. The API is the same like in Twig's default `extends` | See [Twig 3 documentation for `extends`](https://twig.symfony.com/doc/3.x/tags/extends.html) | +| `sw_include` | Includes template partials with support for multi inheritance. The API is the same like in Twig's default `include` but limited to one file at once | See [Twig 3 documentation for `include`](https://twig.symfony.com/doc/3.x/tags/include.html) | +| `sw_embed` | Includes another file with directly overwriting blocks with support for multi inheritance. The API is the same like in Twig's default `embed` | See [Twig 3 documentation for `embed`](https://twig.symfony.com/doc/3.x/tags/embed.html) | +| `sw_use` | Includes template blocks without rendering them from another file with support for multi inheritance. The API is the same like in Twig's default `use` | See [Twig 3 documentation for `use`](https://twig.symfony.com/doc/3.x/tags/use.html) | +| `sw_import` | Includes all macros from another file with support for multi inheritance. The API is the same like in Twig's default `import` | See [Twig 3 documentation for `import`](https://twig.symfony.com/doc/3.x/tags/import.html) | +| `sw_from` | Includes single macros from another file with support for multi inheritance. The API is the same like in Twig's default `from` | See [Twig 3 documentation for `from`](https://twig.symfony.com/doc/3.x/tags/from.html) | | `sw_icon` | Displays an icon from a given icon set | See [Add custom icon](../../../guides/plugins/plugins/storefront/add-icons#adding-icon) guide for details. | | `sw_thumbnails` | Renders a tag with correctly configured “srcset” and “sizes” attributes based on the provided parameters | See [Add thumbnail](../../../guides/plugins/plugins/storefront/use-media-thumbnails) guide for more information. | + +## Functions + +| Function | Description | Notes | +| :--- | :--- | :--- | | `config` | Gets a value from the system config (used by plugins and global settings) for the given sales channel | See [Reading the configuration values](../../../guides/plugins/apps/configuration) | | `theme_config` | Gets a value from the current theme | See [Theme configuration](../../../guides/plugins/themes/theme-configuration) | +| `sw_block` | Renders a block of the same or another file with support for multi inheritance. The is the same like in Twig's default `block` | See [Twig 3 documentation for `block`](https://twig.symfony.com/doc/3.x/functions/block.html) | +| `sw_source` | Prints the content of a template file with support for multi inheritance. The is the same like in Twig's default `source` | See [Twig 3 documentation for `source`](https://twig.symfony.com/doc/3.x/functions/source.html) | +| `sw_include` | Renders the content of another template file with support for multi inheritance. The is the same like in Twig's default `include` and the new `sw_include` tag | See [Twig 3 documentation for `include`](https://twig.symfony.com/doc/3.x/functions/include.html) | ## Filter