Skip to content

Instantly share code, notes, and snippets.

@starx
Last active January 26, 2017 13:55
Show Gist options
  • Save starx/56fd3bcb414b73d46804699c4ce7581f to your computer and use it in GitHub Desktop.
Save starx/56fd3bcb414b73d46804699c4ce7581f to your computer and use it in GitHub Desktop.
{% extends "@app/form_layout.html.twig" %}
{% block _{FORM_NAME}_{ELEMENT_NAME}_widget %}
{{ form_widget(form) }} Modified
{% endblock %}
@starx
Copy link
Author

starx commented Jan 26, 2017

For example: A test form type

class TestType extends AbstractType
{
    public function buildForm(FormBuilderInterface $builder, array $options)
    {
        parent::buildForm($builder, $options);
        $builder
            ->add("field1", "textarea", array("required"=>false))
        ;

    }

    public function getName()
    {
        return "test";
    }
}

could be overridden as such:

{% extends "@app/form_layout.html.twig" %}
{% block _test_field1_widget %}
        {{ form_widget(form) }} modified
{% endblock %}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment