Twig function
|
Description
|
Typical Usage / Notes
|
aero(key) |
Retrieves a value from the current store using the supplied key. |
Useful for accessing store-level properties dynamically. |
locale() |
Returns the current store locale as a two-letter language code, e.g. en. |
Useful when language-specific behaviour or markup is required. |
page_title() |
Returns the current page's SEO title. |
Used for page titles and SEO-related markup. |
store_name() |
Returns the current store's name. |
Useful for displaying the store name in templates. |
store_logo() |
Returns the URL of the current store's logo, or an empty string if no logo is configured. |
Useful for displaying the store logo. |
email_logo() |
Returns the URL of the store's email logo, or an empty string if none is configured. |
Intended for email templates. |
store_address() |
Returns the current store's address as an array. |
Useful when rendering store address information. |
active(...) |
Determines whether a given item/route is currently active using the application's active service. |
Commonly used to apply active states to navigation elements. |
blocks(key, limit = null, data = []) |
Returns the block items belonging to a specified block/group. |
Can optionally limit the number of items or filter by block type. |
block_items(key, limit = null, data = []) |
Alias of blocks(). Returns block items for a specified block/group. |
Provides an alternative, more descriptive name when working with block collections. |
block_item(key, index = 0, data = []) |
Returns a specific block item from a block/group by its index. |
Useful when a template needs a particular block item rather than the whole collection. |
block_exists(key, count = null) |
Checks whether a block/group contains any items. Can also check whether it contains at least a specified number of items. |
Useful for conditionally rendering block-based content. |
block_item_exists(key, index = 0) |
Checks whether a block contains an item at a specified index. |
Useful for safely checking whether a particular block item exists before rendering it. |
breadcrumb(...) |
Returns the current breadcrumb/crumb collection. |
Used to render breadcrumb navigation. |
base64_encode(content) |
Base64-encodes the supplied content. |
Useful when content needs to be represented as Base64 within a template. |
image_factory(width, height, path = '') |
Creates an ImageFactory instance for generating/manipulating an image with the specified dimensions and optional path. |
Used when template-level image generation or processing is required. |
theme_asset(path, secure = null) |
Generates the URL for an asset within the current theme. |
Useful for referencing theme CSS, JS, images, fonts, etc. |
theme_mix(path) |
Generates the URL for a theme asset processed through Laravel Mix. |
Used for versioned/compiled theme assets. |
theme_vite(entrypoints, directory = 'build') |
Generates Vite asset tags/URLs for entry points within the current theme. |
Used to load Vite-built theme assets. |
vite(entrypoints, directory = 'build') |
Generates Vite asset tags/URLs for the supplied entry points. |
Used to load application-level Vite assets. |
theme_css(path) |
Generates a stylesheet reference for a CSS file within the current theme. |
Handles theme CSS and can render it inline where appropriate. |
view_exists(view) |
Checks whether a specified view exists. |
Useful for conditionally rendering optional views. |
setting(...) |
Retrieves an application/store setting using its key. |
Provides access to configured settings from Twig. |
cart(...) |
Retrieves the current cart from the request. |
Used to access cart information in storefront templates. |
currency(amount = null) |
Returns the current currency, or formats a supplied amount using the current currency. |
Useful for displaying correctly formatted prices. |
css(path, url) |
Generates CSS output for a stylesheet, either as an inline <style> block or a <link> element depending on the context. |
Used to include CSS dynamically in templates. |
section(name, properties = []) |
Renders a named view from the sections view directory and passes it the supplied properties. |
Useful for reusable page sections. |
snippet(name, properties = []) |
Renders a named view from the snippets view directory and passes it the supplied properties. |
Useful for small, reusable pieces of template markup. |
form(name, properties = []) |
Renders a named form view and processes the resulting template through Twig. |
Used to render reusable forms from Twig. Renders forms.{name} view. |
has_route(name) |
Checks whether a named Laravel route exists. |
Useful when conditionally generating links or navigation based on route availability. |