Edit on GitHub
Jump to docs navigation

Twig Components / Methods / field_factory

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.