Edit on GitHub
Jump to docs navigation

Twig Components / Methods / config

Note: You are currently reading the documentation for Bolt 5.0. Looking for the documentation for Bolt 5.2 instead?

config = object(Bolt\Configuration\Config) is a Twig global to be used to access the configuration available in your config.yaml and contenttypes.yaml files. It has a bunch of useful methods.

get(path)

Returns a config value using a path

{% set sitename = config.get('general/sitename') %}
{% set accepted_file_types = config.get('general/accept_file_types') %}

has(path)

Returns true if config matches path, and false otherwise.

{% set has_sitename = config.get('general/sitename') %} # returns true
{% set has_fakedummy = config.get('fake/dummy) %} # returns false

contentType(contenttype)

Returns the configuration for the given contenttype.

{% set homepage_config = config.contentType('homepage') %}


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.