mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-12 13:24:25 +00:00
adding location hidden field in Calendar formType
This commit is contained in:
parent
4677fadf6f
commit
0e18a3ada9
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
namespace Chill\CalendarBundle\Form;
|
namespace Chill\CalendarBundle\Form;
|
||||||
|
|
||||||
|
use Chill\MainBundle\Entity\Location;
|
||||||
use Symfony\Component\Form\AbstractType;
|
use Symfony\Component\Form\AbstractType;
|
||||||
use Symfony\Component\Form\FormBuilderInterface;
|
use Symfony\Component\Form\FormBuilderInterface;
|
||||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||||
@ -178,6 +179,20 @@ class CalendarType extends AbstractType
|
|||||||
))
|
))
|
||||||
;
|
;
|
||||||
|
|
||||||
|
$builder->add('location', HiddenType::class)
|
||||||
|
->get('location')
|
||||||
|
->addModelTransformer(new CallbackTransformer(
|
||||||
|
function (?Location $location): string {
|
||||||
|
if (null === $location) {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
return $location->getId();
|
||||||
|
},
|
||||||
|
function (?string $id): Location {
|
||||||
|
return $this->om->getRepository(Location::class)->findOneBy(['id' => (int) $id]);
|
||||||
|
}
|
||||||
|
))
|
||||||
|
;
|
||||||
|
|
||||||
// $builder->add('invites', HiddenType::class);
|
// $builder->add('invites', HiddenType::class);
|
||||||
// $builder->get('invites')
|
// $builder->get('invites')
|
||||||
|
@ -38,7 +38,10 @@
|
|||||||
{{ form_row(form.calendarRange) }}
|
{{ form_row(form.calendarRange) }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
.. location
|
{%- if form.location is defined -%}
|
||||||
|
{{ form_row(form.location) }}
|
||||||
|
<div id="location"></div>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
{%- if form.comment is defined -%}
|
{%- if form.comment is defined -%}
|
||||||
{{ form_row(form.comment) }}
|
{{ form_row(form.comment) }}
|
||||||
|
@ -34,7 +34,10 @@
|
|||||||
{{ form_row(form.endDate) }}
|
{{ form_row(form.endDate) }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
.. location
|
{%- if form.location is defined -%}
|
||||||
|
{{ form_row(form.location) }}
|
||||||
|
<div id="location"></div>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
{%- if form.comment is defined -%}
|
{%- if form.comment is defined -%}
|
||||||
{{ form_row(form.comment) }}
|
{{ form_row(form.comment) }}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user