Twig Components / Methods / field_factory
Note: You are currently reading the documentation for Bolt 5.0. Looking for the documentation for Bolt 5.2 instead?
field_factory(name, definition = null)
is a Twig function to create a field on the fly with a name and optional definition.
Parameter | Description |
---|---|
name | The name of the field |
definition | The definition of the field, same options as a field definition in contenttypes.yaml |
{% set field = field_factory('title', { 'type': 'text', 'label' : 'Awesome title' }) %}
Source: Forms
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.