Forms created with the Symfony Form component and Twig templates can be customized to render as Semantic UI forms using the form theme included in this bundle. For more information on using form themes, take a look at the Symfony Forms documentation.

Render a single form

To render a single form with the Semantic UI form theme, include the form_theme tag inside your template:

{% extends 'base.html.twig' %}

{% form_theme form '@HarmonyUi/form/semantic_2_layout.html.twig' %}

{% block content %}
    {# ... render the form #}

    {{ form(form) }}
{% endblock %}

Render all forms

To render all forms in your application with the Semantic UI form theme, add the following configuration for the Twig component to your Symfony application:

# app/config/config.yml (Symfony 3)
# config/packages/twig.yaml (Symfony 4)
twig:
    form_themes:
        - '@HarmonyUi/form/semantic_2_layout.html.twig'

This page was last updated on 06 Dec 2017, at 20:01.