Created
June 6, 2017 14:56
-
-
Save gaetanhauray/81f20d3d9e9e8c89f7e19d2985a77365 to your computer and use it in GitHub Desktop.
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 checkbox_widget %} | |
<div class="checkbox_widget"> | |
{% set type = type|default('checkbox') %} | |
{{ block('form_widget_simple') }} | |
</div> | |
{% 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
/** | |
* On affiche une coche pour chaque coregistration | |
*/ | |
$builder->addEventListener( | |
FormEvents::PRE_SET_DATA, | |
function (FormEvent $event) { | |
/** @var CoregistrationVO $coregistration */ | |
$coregistration = $event->getData(); | |
$form = $event->getForm(); | |
$form->add( | |
"accepted", | |
CheckboxType::class, | |
array( | |
'label' => $coregistration->getSentence(), | |
'attr' => array( | |
'class' => 'field-checkbox', | |
'logourl' => $coregistration->getLogoUrl() | |
), | |
'required' => false, | |
) | |
); | |
} | |
); |
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
{% form_theme form 'form/coregistration.html.twig' %} | |
{{ form_widget(formElement) }} | |
{# Ici formElement correspond à une checkbox #} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment