Twig Components
As mentioned before, a template in Bolt can use all of the standard Twig tags, function, filters, tests & operators, with a few additions that are specific to working with Bolt. If you're not familiar with Twig yet, you should read "Twig for Template Designers", on the official Twig website.
Function¶
Twig (built-in)¶
- asset_version(path, packageName = null) (Twig)
- asset(path, packageName = null) (Twig)
- attribute (Twig)
- block (Twig)
- constant (Twig)
- constant(constant, object = null) (Twig)
- country_timezones (Twig)
- country_timezones(country) (Twig)
- csrf_token(tokenId) (Twig)
- cycle (Twig)
- cycle(values, position) (Twig)
- date (Twig)
- date(date = null, timezone = null) (Twig)
- dump (Twig)
- encore_entry_css_files(entryName, entrypointName = "_default") (Twig)
- encore_entry_js_files(entryName, entrypointName = "_default") (Twig)
- encore_entry_link_tags(entryName, packageName = null, entrypointName = "_default", attributes = []) (Twig)
- encore_entry_script_tags(entryName, packageName = null, entrypointName = "_default", attributes = []) (Twig)
- fragment_uri(controller, absolute = false, strict = true, sign = true) (Twig)
- html_classes (Twig)
- html_classes(args) (Twig)
- impersonation_exit_path(exitTo = null) (Twig)
- impersonation_exit_url(exitTo = null) (Twig)
- include (Twig)
- include(template, variables = [], withContext = true, ignoreMissing = false, sandboxed = false) (Twig)
- is_granted(role, object = null, field = null) (Twig)
- link(uri, rel, attributes = []) (Twig)
- logout_path(key = null) (Twig)
- logout_url(key = null) (Twig)
- max (Twig)
- max(args) (Twig)
- min(args) (Twig)
- parent (Twig)
- random (Twig)
- range (Twig)
- source (Twig)
- template_from_string (Twig)
Bolt¶
- __(id, parameters = [], domain = null, locale = null) (Bolt)
- absolute_link(link) (Bolt)
- absolute_url(path) (Bolt)
- admin_menu_array() (Bolt)
- backtrace(options = 2, limit = 25) (Bolt)
- canonical(route = null, params = []) (Bolt)
- countwidgets(target) (Bolt)
- dump() (Bolt)
- excerpt(content, length = 280, includeTitle = false, focus = null, wrap = false) (Bolt)
- extension_exists(name) (Bolt)
- extensions() (Bolt)
- field_factory(name, definition = null) (Forms)
- find_translations(entity, locale = null) (Bolt)
- first_related_content(content, name = null, publishedOnly = true) (Bolt)
- flag(localeCode) (Bolt)
- getuser(username = null, id = null, displayname = null, email = null) (Bolt)
- haswidgets(target) (Bolt)
- htmllang() (Bolt)
- icon(record = null, icon = "question-circle") (Bolt)
- knp_menu_get_breadcrumbs_array(menu, subItem = null) (KNP Menu)
- knp_menu_get_current_item(menu) (KNP Menu)
- knp_menu_get(menu, path = [], options = []) (KNP Menu)
- knp_menu_render(menu, options = [], renderer = null) (KNP Menu)
- list_templates(field) (Bolt)
- listwidgets(target) (Bolt)
- locale(localeCode) (Bolt)
- locales(localeCodes = null, all = false) (Bolt)
- markdown(content) (Bolt)
- media(unknown?) (Bolt)
- menu_array(name = null) (Bolt)
- menu(name = null, template = "helpers\/_menu.html.twig", class = "", withsubmenus = true) (Bolt)
- pager(records = null, template = "@bolt\/helpers\/_pager_basic.html.twig", class = "pagination", surround = 3) (Bolt)
- paginate() (Bolt)
- path(name, parameters = [], relative = false) (Bolt)
- popup(image, width = 320, height = 240) (Bolt)
- previous_record(content, byColumn = "id", sameContentType = true) (Bolt)
- redirect(path) (Bolt)
- related_content_by_type(content, bidirectional = true, limit = null, publishedOnly = true) (Bolt)
- related_content(content, name = null, bidirectional = true, limit = null, publishedOnly = true) (Bolt)
- relative_path(path) (Bolt)
- select_options(field) (Bolt)
- showimage(image, width = null, height = null) (Bolt)
- source(name, ignoreMissing = false) Twig
- thumbnail(image, width = null, height = null, location = null, path = null, fit = null) (Bolt)
- url(name, parameters = [], schemeRelative = false) (Bolt)
- widget(name, params = []) (Bolt)
- widgets(target, params = []) (Bolt)
Symfony¶
- controller(controller, attributes = [], query = []) (Symfony)
- dns_prefetch(uri, attributes = []) (Symfony)
- form_end(form_view, variables) (Symfony)
- form_errors(form_view) (Symfony)
- form_help(form_view) (Symfony)
- form_label(form_view, label, variables) (Symfony)
- form_parent(form_view) (Symfony)
- form_rest(form_view, variables) (Symfony)
- form_row(form_view, variables) (Symfony)
- form_start(form_view, variables) (Symfony)
- form_widget(form_view, variables) (Symfony)
- form(form_view, variables) (Symfony)
- preconnect(uri, attributes = []) (Symfony)
- prefetch(uri, attributes = []) (Symfony)
- preload(uri, attributes = []) (Symfony)
- prerender(uri, attributes = []) (Symfony)
- render(uri, options = []) (Symfony)
- t(message, parameters = [], domain = null) (Symfony)
Filter¶
Twig(built-in)¶
- abbr_class (Twig)
- abbr_method (Twig)
- abs (Twig)
- batch(size, fill = null, preserveKeys = true) (Twig)
- capitalize (Twig)
- column(name, index = null) (Twig)
- convert_encoding(to, from) (Twig)
- country_name(locale = null) (Twig)
- currency_name(locale = null) (Twig)
- currency_symbol(locale = null) (Twig)
- data_uri(mime = null, parameters = []) (Twig)
- date_modify(modifier) (Twig)
- default(default = "") (Twig)
- e(strategy = "html", charset = null, autoescape = false) (Twig)
- escape(strategy = "html", charset = null, autoescape = false) (Twig)
- feature (Twig)
- filter(arrow) (Twig)
- first (Twig)
- format_args (Twig)
- format_args_as_text (Twig)
- format_bytes(precision = 2) (Twig)
- format_currency(currency, attrs = [], locale = null) (Twig)
- format_date(dateFormat = "medium", pattern = "", timezone = null, calendar = "gregorian", locale = null) (Twig)
- format_datetime(dateFormat = "medium", timeFormat = "medium", pattern = "", timezone = null, calendar = "gregorian", locale = null) (Twig)
- format_file_from_text (Twig)
- format_file(line, text = null) (Twig)
- format_number(attrs = [], style = "decimal", type = "default", locale = null) (Twig)
- format_time(timeFormat = "medium", pattern = "", timezone = null, calendar = "gregorian", locale = null) (Twig)
- format(args) (Twig)
- humanize (Twig)
- join(glue = "", and = null) (Twig)
- json_encode(options, depth) (Twig)
- keys (Twig)
- language_name(locale = null) (Twig)
- last (Twig)
- length (Twig)
- lower (Twig)
- map(arrow) (Twig)
- merge(arr2) (Twig)
- nl2br(is_xhtml) (Twig)
- number_format(decimal = null, decimalPoint = null, thousandSep = null) (Twig)
- order(on = "-publishedAt", onSecondary = null, locale = null) (Twig)
- replace(from) (Twig)
- reverse(preserveKeys = false) (Twig)
- round(precision = 0, method = "common") (Twig)
- serialize(format = "json", context = []) (Twig)
- shuffle (Twig)
- slice(start, length = null, preserveKeys = false) (Twig)
- sort(arrow = null) (Twig)
- spaceless (Twig)
- split(delimiter, limit = null) (Twig)
- timezone_name(locale = null) (Twig)
- upper (Twig)
- yaml_dump(inline = 0, dumpObjects = 0) (Twig)
- yaml_encode(inline = 0, dumpObjects = 0) (Twig)
Bolt¶
- allow_twig(unknown?) (Bolt)
- current (Bolt)
- date(format = null, timezone = null) (Bolt)
- edit_link (Bolt)
- excerpt(length = 280, includeTitle = false, focus = null, wrap = false) (Bolt)
- has_path(path) (Bolt)
- image(onlyValues = false) (Bolt)
- json_decode(assoc = false, depth = 512, options = 0) (Bolt)
- json_records(includeDefinition = true, options = 0, locale = "") (Bolt)
- knp_menu_as_string(separator = " > ") (KNP Menu)
- label (Bolt)
- link(canonical = false, locale = null) (Bolt)
- localdate(format = null, locale = null, timezone = null) (Bolt)
- locale_name(locale = null) (Bolt)
- markdown (Bolt)
- media (Bolt)
- next(byColumn = "id", sameContentType = true) (Bolt)
- next_record(content, byColumn = "id", sameContentType = true) (Bolt)
- normalize_records(locale = "") (Bolt)
- placeholders(replacements = []) (Bolt)
- plaintext (Bolt)
- popup(width = 320, height = 240) (Bolt)
- previous(byColumn = "id", sameContentType = true) (Bolt)
- related_by_type(bidirectional = true, limit = null, publishedOnly = true) (Bolt)
- related_first(name = null, publishedOnly = true) (Bolt)
- related(name = null, bidirectional = true, limit = null, publishedOnly = true) (Bolt)
- safestring(strict = false, extrachars = "") (Bolt)
- sanitise (Bolt)
- selected(returnsingle = false, returnarray = false) (Bolt)
- showimage(width = null, height = null) (Bolt)
- shy (Bolt)
- slug (Bolt)
- striptags(allowable_tags) (Bolt)
- svg (Bolt)
- taxonomies (Bolt)
- thumbnail(width = null, height = null, location = null, path = null, fit = null) (Bolt)
- title_case (Bolt)
- title(locale = "", length = 120) (Bolt)
- trans(arguments = [], domain = null, locale = null, count = null) (Bolt)
- translate(locale) (Bolt)
- trim(characterMask = null, side = "both") (Bolt)
- ucwords(delimiters = "") (Bolt)
- url_decode (Bolt)
- url_encode (Bolt)
Symfony¶
- file_excerpt(line, srcContext = 3) Symfony
- file_link(line) (Symfony)
- file_relative (Symfony)
- raw (Symfony)
- record (Symfony)
- reduce(arrow, initial = null) (Symfony)
Jasny¶
- as_array (Jasny)
- html_attr (Jasny)
- less(replace = "...", break = "") (Jasny)
- line(line = 1) (Jasny)
- linkify(protocols = ["http","mail"], attributes = [], mode = "normal") (Jasny)
- paragraph (Jasny)
- preg_filter(pattern, replacement = "", limit = -1) (Jasny)
- preg_get_all(pattern, group = 0) (Jasny)
- preg_get(pattern, group = 0) (Jasny)
- preg_grep(pattern, flags = "") (Jasny)
- preg_match(pattern) (Jasny)
- preg_quote(delimiter = "\/") (Jasny)
- preg_replace(pattern, replacement = "", limit = -1) (Jasny)
- preg_split(pattern) (Jasny)
- product (Jasny)
- sum (Jasny)
- truncate(length, replace = "...") (Jasny)
- values (Jasny)
Squirrelphp¶
- boolval (Squirrelphp)
- floatval (Squirrelphp)
- intval (Squirrelphp)
- strtotime(now) (Squirrelphp)
- strval (Squirrelphp)
Global¶
Bolt¶
- app = object(Symfony\Bridge\Twig\AppVariable) (Bolt)
- config = object(Bolt\Configuration\Config) (Bolt)
- defaultLocale = "en" (Bolt)
Tag¶
Twig (built-in)¶
- apply (Twig)
- autoescape (Twig)
- block (Twig)
- cache (Twig)
- deprecated (Twig)
- do (Twig)
- embed (Twig)
- extends (Twig)
- flush (Twig)
- for (Twig)
- from (Twig)
- if (Twig)
- import (Twig)
- include (Twig)
- macro (Twig)
- sandbox (Twig)
- set (Twig)
- verbatim (Twig)
- with (Twig)
- use (Twig)
Bolt¶
- setcontent (Bolt)
Squirrelphp¶
Test¶
Twig (built-in)¶
- constant (Twig)
- defined (Twig)
- divisible by (Twig)
- empty (Twig)
- even (Twig)
- iterable (Twig)
- none (Twig)
- null (Twig)
- odd (Twig)
- same as (Twig)
Bolt¶
- extension (Bolt)
Symfony¶
- rootform (Symfony)
- selectedchoice (Symfony)
Squirrelphp¶
- array (Squirrelphp)
- bool (Squirrelphp)
- boolean (Squirrelphp)
- callable (Squirrelphp)
- false (Squirrelphp)
- float (Squirrelphp)
- int (Squirrelphp)
- integer (Squirrelphp)
- object (Squirrelphp)
- scalar (Squirrelphp)
- string (Squirrelphp)
- true (Squirrelphp)
KNP¶
- knp_menu_ancestor (KNP Menu)
- knp_menu_current (KNP Menu)
Other pages in this section:
- Twig tags
- Twig functions
- Twig filters
- Available variables in Twig
- Twig tests
- Extras (or "Magic Attributes")
- Menu
- The Fields iterator
- Pagination
- Language selector
- All available Twig Methods
Edit this page on GitHub
Couldn't find what you were looking for? We are happy to help you in the forum, on Slack or on Github.
Couldn't find what you were looking for? We are happy to help you in the forum, on Slack or on Github.