Shopware's twig functions 
In Shopware, Twig's functionality is extended with custom tags, functions, filters, and extensions.
INFO
Official support for complete Twig multi inheritance using sw_* equivalents available since 6.7
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.
Tags 
| Function | Description | Notes | 
|---|---|---|
| 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 | 
| sw_include | Includes template partials with support for multi inheritance. The API is the same like in Twig's default includebut limited to one file at once | See Twig 3 documentation for include | 
| 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 | 
| 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 | 
| 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 | 
| 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 | 
| sw_icon | Displays an icon from a given icon set | See Add custom icon guide for details. | 
| sw_thumbnails | Renders a tag with correctly configured “srcset” and “sizes” attributes based on the provided parameters | See Add thumbnail 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 | 
| theme_config | Gets a value from the current theme | See 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 | 
| 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 | 
| sw_include | Renders the content of another template file with support for multi inheritance. The is the same like in Twig's default includeand the newsw_includetag | See Twig 3 documentation for include | 
Filter 
| Filter | Description | Notes | 
|---|---|---|
| replace_recursive | Enables recursive replacement in addition to twig's default replacefilter | To see an example, see the guide on add custom JavaScript | 
| currency | Adopts currency formatting: The currency symbol and the comma setting. | --- | 
| sw_sanitize | Filters tags and attributes from a given string. By default, twig's auto escaping is on, so this filter explicitly allows basic HTML tags like <i%gt;, <b>,... | --- | 
| sw_convert_unit | Convert between measurement units | Available since 6.7.1.0, to see examples, see the adr on the measurement system | 
Extensions 
| Extension | Description | Notes | 
|---|---|---|
| sw_breadcrumb_full() | Returns all categories defined in the breadcrumb as an array | Contains functionalities of sw_breadcrumb_typesandsw_breadcrumb_build_types | 
| sw_breadcrumb() | Returns the category tree as array. Entry points of the SalesChannel ( e.g. footer, navigation) are filtered out. | Deprecated in 6.5.0 | 
| sw_breadcrumb_types() | Yields the types of the categories within the breadcrumb | Deprecated in 6.5.0 | 
| sw_breadcrumb_build_types() | returns the same as sw_breadcrumb_types, only without another repository call | Deprecated in 6.5.0 | 
| seoUrl() | Returns seo URL of given route | --- | 
| searchMedia() | Resolves media ids to media objects | See Add media guide for details. | 
| rawUrl() | Returns full URL | --- |