Created
February 22, 2019 11:50
-
-
Save maninhat/76ce6020cb2bf6521031a66481199323 to your computer and use it in GitHub Desktop.
Symfony Fieldset form type
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{% block fieldset_row %} | |
<fieldset {{ block('widget_container_attributes') }}> | |
<legend{% if label_attr %}{% with { attr: label_attr } %}{{ block('attributes') }}{% endwith %}{% endif %}>{{ translation_domain is same as(false) ? label : label|trans({}, translation_domain) }}</legend> | |
{%- if form.parent is empty -%} | |
{{ form_errors(form) }} | |
{%- endif -%} | |
{{- block('form_rows') -}} | |
{{- form_rest(form) -}} | |
</fieldset> | |
{% endblock %} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
use Symfony\Component\Form\AbstractType; | |
use Symfony\Component\OptionsResolver\OptionsResolver; | |
class FieldsetType extends AbstractType | |
{ | |
public function configureOptions(OptionsResolver $resolver) | |
{ | |
$resolver->setDefault('inherit_data', true); | |
} | |
public function getBlockPrefix() | |
{ | |
return 'fieldset'; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment