Skip to main content

Twig Extensions

Prodyflow provides several custom Twig functions and filters to simplify template rendering and access webshop data.

Key Functions

  • include_html(path)
    Includes an external HTML file from the template files. Useful for reusable content blocks.

  • linklists(name)
    Returns a structured array of menu items and subitems for navigation rendering.

Key Filters

  • asset_url(value) – Generates the full URL for assets in the template's assets folder.
  • t(value) – Returns the translated value from the section settings based on the current locale. Falls back to the default language or the first available value.
  • trans(key, replace, locale) – Returns the translated value from the global translations based on the current locale. Falls back to the default language or the first available value.
  • json(key, replace, locale) – Converts an array or object to JSON.

Media Filters

  • image_url(value, args) – Returns the correct URL for an image. Supports various sizes and different image sources.
  • image_srcset(value) – Generates a srcset attribute for responsive images.
  • video_srcset(value) – Generates an array of video sources with different qualities for adaptive streaming.
  • video_poster(value) – Returns the path for a video poster image.

URL Filters

  • localized_url(value) – Returns the localized URL for a given path.
  • sale_channel_url(value) – Returns the full webshop URL for a specific sales channel.

Money Formatting

  • money(value) – Formats a numeric value as a currency string.

These Twig extensions allow templates to remain clean, while providing powerful tools for dynamic content, localization, media handling, and formatting directly within the Twig layer.