mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-13 05:44:24 +00:00
move service form.type definition to new file + introduce date type
This commit is contained in:
parent
d5c26c6d47
commit
edc4889461
@ -91,6 +91,7 @@ class ChillMainExtension extends Extension implements PrependExtensionInterface,
|
|||||||
$loader->load('services/repositories.yml');
|
$loader->load('services/repositories.yml');
|
||||||
$loader->load('services/pagination.yml');
|
$loader->load('services/pagination.yml');
|
||||||
$loader->load('services/export.yml');
|
$loader->load('services/export.yml');
|
||||||
|
$loader->load('services/form.yml');
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
47
Form/Type/ChillDateType.php
Normal file
47
Form/Type/ChillDateType.php
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
<?php
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2017 Champs Libres Cooperative <info@champs-libres.coop>
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Affero General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU Affero General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Affero General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
namespace Chill\MainBundle\Form\Type;
|
||||||
|
|
||||||
|
use Symfony\Component\Form\AbstractType;
|
||||||
|
use Symfony\Component\Form\Extension\Core\Type\DateType;
|
||||||
|
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Display the date in a date picker.
|
||||||
|
*
|
||||||
|
* Extends the symfony `Symfony\Component\Form\Extension\Core\Type\DateType`
|
||||||
|
* to automatically create a date picker.
|
||||||
|
*
|
||||||
|
* @author Julien Fastré <julien.fastre@champs-libres.coop>
|
||||||
|
*/
|
||||||
|
class ChillDateType extends AbstractType
|
||||||
|
{
|
||||||
|
public function configureOptions(OptionsResolver $resolver)
|
||||||
|
{
|
||||||
|
$resolver
|
||||||
|
->setDefault('widget', 'single_text')
|
||||||
|
->setDefault('attr', [ 'class' => 'datepicker' ])
|
||||||
|
->setDefault('format', 'dd-MM-yyyy')
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getParent()
|
||||||
|
{
|
||||||
|
return DateType::class;
|
||||||
|
}
|
||||||
|
}
|
@ -36,15 +36,6 @@ services:
|
|||||||
tags:
|
tags:
|
||||||
- { name: twig.extension }
|
- { name: twig.extension }
|
||||||
|
|
||||||
chill.main.form.type.translatable.string:
|
|
||||||
class: Chill\MainBundle\Form\Type\TranslatableStringFormType
|
|
||||||
arguments:
|
|
||||||
- "%chill_main.available_languages%"
|
|
||||||
#- "%framework.translator.fallback%"
|
|
||||||
- "@translator.default"
|
|
||||||
tags:
|
|
||||||
- { name: form.type, alias: translatable_string }
|
|
||||||
|
|
||||||
chill.main.helper.translatable_string:
|
chill.main.helper.translatable_string:
|
||||||
class: Chill\MainBundle\Templating\TranslatableStringHelper
|
class: Chill\MainBundle\Templating\TranslatableStringHelper
|
||||||
arguments:
|
arguments:
|
||||||
@ -70,38 +61,6 @@ services:
|
|||||||
tags:
|
tags:
|
||||||
- { name: twig.extension }
|
- { name: twig.extension }
|
||||||
|
|
||||||
chill.main.form.type.select2choice:
|
|
||||||
class: Chill\MainBundle\Form\Type\Select2ChoiceType
|
|
||||||
tags:
|
|
||||||
- {name: form.type, alias: select2_choice}
|
|
||||||
|
|
||||||
chill.main.form.type.select2entity:
|
|
||||||
class: Chill\MainBundle\Form\Type\Select2EntityType
|
|
||||||
tags:
|
|
||||||
- {name: form.type, alias: select2_entity }
|
|
||||||
|
|
||||||
chill.main.form.type.select2country:
|
|
||||||
class: Chill\MainBundle\Form\Type\Select2CountryType
|
|
||||||
arguments:
|
|
||||||
- "@request_stack"
|
|
||||||
- "@doctrine.orm.entity_manager"
|
|
||||||
tags:
|
|
||||||
- { name: form.type, alias: select2_chill_country }
|
|
||||||
|
|
||||||
chill.main.form.type.select2language:
|
|
||||||
class: Chill\MainBundle\Form\Type\Select2LanguageType
|
|
||||||
arguments:
|
|
||||||
- "@request_stack"
|
|
||||||
- "@doctrine.orm.entity_manager"
|
|
||||||
tags:
|
|
||||||
- { name: form.type, alias: select2_chill_language }
|
|
||||||
chill.main.form.type.center:
|
|
||||||
class: Chill\MainBundle\Form\Type\CenterType
|
|
||||||
arguments:
|
|
||||||
- "@security.token_storage"
|
|
||||||
- "@chill.main.form.data_transformer.center_transformer"
|
|
||||||
tags:
|
|
||||||
- { name: form.type, alias: center }
|
|
||||||
chill.main.form.data_transformer.center_transformer:
|
chill.main.form.data_transformer.center_transformer:
|
||||||
class: Chill\MainBundle\Form\Type\DataTransformer\CenterTransformer
|
class: Chill\MainBundle\Form\Type\DataTransformer\CenterTransformer
|
||||||
arguments:
|
arguments:
|
||||||
@ -125,14 +84,6 @@ services:
|
|||||||
chill.main.role_provider:
|
chill.main.role_provider:
|
||||||
class: Chill\MainBundle\Security\RoleProvider
|
class: Chill\MainBundle\Security\RoleProvider
|
||||||
|
|
||||||
chill.main.form.type.composed_role_scope:
|
|
||||||
class: Chill\MainBundle\Form\Type\ComposedRoleScopeType
|
|
||||||
arguments:
|
|
||||||
- "@chill.main.helper.translatable_string"
|
|
||||||
- "@chill.main.role_provider"
|
|
||||||
tags:
|
|
||||||
- { name: form.type, alias: composed_role_scope }
|
|
||||||
|
|
||||||
chill.main.validator.role_scope_scope_presence:
|
chill.main.validator.role_scope_scope_presence:
|
||||||
class: Chill\MainBundle\Validation\Validator\RoleScopeScopePresence
|
class: Chill\MainBundle\Validation\Validator\RoleScopeScopePresence
|
||||||
arguments:
|
arguments:
|
||||||
@ -141,13 +92,6 @@ services:
|
|||||||
- "@translator"
|
- "@translator"
|
||||||
tags:
|
tags:
|
||||||
- { name: validator.constraint_validator, alias: 'role_scope_scope_presence' }
|
- { name: validator.constraint_validator, alias: 'role_scope_scope_presence' }
|
||||||
|
|
||||||
chill.main.form.type.postal_code_type:
|
|
||||||
class: Chill\MainBundle\Form\Type\PostalCodeType
|
|
||||||
arguments:
|
|
||||||
- "@chill.main.helper.translatable_string"
|
|
||||||
tags:
|
|
||||||
- { name: form.type }
|
|
||||||
|
|
||||||
chill.main.export_manager:
|
chill.main.export_manager:
|
||||||
class: Chill\MainBundle\Export\ExportManager
|
class: Chill\MainBundle\Export\ExportManager
|
||||||
@ -157,33 +101,3 @@ services:
|
|||||||
- "@security.authorization_checker"
|
- "@security.authorization_checker"
|
||||||
- "@chill.main.security.authorization.helper"
|
- "@chill.main.security.authorization.helper"
|
||||||
- "@security.token_storage"
|
- "@security.token_storage"
|
||||||
|
|
||||||
chill.main.form.type.export:
|
|
||||||
class: Chill\MainBundle\Form\Type\Export\ExportType
|
|
||||||
arguments:
|
|
||||||
- "@chill.main.export_manager"
|
|
||||||
tags:
|
|
||||||
- { name: form.type }
|
|
||||||
|
|
||||||
chill.main.form.pick_formatter_type:
|
|
||||||
class: Chill\MainBundle\Form\Type\Export\PickFormatterType
|
|
||||||
arguments:
|
|
||||||
- "@chill.main.export_manager"
|
|
||||||
tags:
|
|
||||||
- { name: form.type }
|
|
||||||
|
|
||||||
chill.main.form.pick_centers_type:
|
|
||||||
class: Chill\MainBundle\Form\Type\Export\PickCenterType
|
|
||||||
arguments:
|
|
||||||
- "@security.token_storage"
|
|
||||||
- "@chill.main.export_manager"
|
|
||||||
- "@chill.main.security.authorization.helper"
|
|
||||||
tags:
|
|
||||||
- { name: form.type }
|
|
||||||
|
|
||||||
chill.main.form.formatter_type:
|
|
||||||
class: Chill\MainBundle\Form\Type\Export\FormatterType
|
|
||||||
arguments:
|
|
||||||
- "@chill.main.export_manager"
|
|
||||||
tags:
|
|
||||||
- { name: form.type }
|
|
||||||
|
93
Resources/config/services/form.yml
Normal file
93
Resources/config/services/form.yml
Normal file
@ -0,0 +1,93 @@
|
|||||||
|
services:
|
||||||
|
chill.main.form.type.translatable.string:
|
||||||
|
class: Chill\MainBundle\Form\Type\TranslatableStringFormType
|
||||||
|
arguments:
|
||||||
|
- "%chill_main.available_languages%"
|
||||||
|
#- "%framework.translator.fallback%"
|
||||||
|
- "@translator.default"
|
||||||
|
tags:
|
||||||
|
- { name: form.type, alias: translatable_string }
|
||||||
|
|
||||||
|
chill.main.form.type.select2choice:
|
||||||
|
class: Chill\MainBundle\Form\Type\Select2ChoiceType
|
||||||
|
tags:
|
||||||
|
- {name: form.type, alias: select2_choice}
|
||||||
|
|
||||||
|
chill.main.form.type.select2entity:
|
||||||
|
class: Chill\MainBundle\Form\Type\Select2EntityType
|
||||||
|
tags:
|
||||||
|
- {name: form.type, alias: select2_entity }
|
||||||
|
|
||||||
|
chill.main.form.type.select2country:
|
||||||
|
class: Chill\MainBundle\Form\Type\Select2CountryType
|
||||||
|
arguments:
|
||||||
|
- "@request_stack"
|
||||||
|
- "@doctrine.orm.entity_manager"
|
||||||
|
tags:
|
||||||
|
- { name: form.type, alias: select2_chill_country }
|
||||||
|
|
||||||
|
chill.main.form.type.select2language:
|
||||||
|
class: Chill\MainBundle\Form\Type\Select2LanguageType
|
||||||
|
arguments:
|
||||||
|
- "@request_stack"
|
||||||
|
- "@doctrine.orm.entity_manager"
|
||||||
|
tags:
|
||||||
|
- { name: form.type, alias: select2_chill_language }
|
||||||
|
chill.main.form.type.center:
|
||||||
|
class: Chill\MainBundle\Form\Type\CenterType
|
||||||
|
arguments:
|
||||||
|
- "@security.token_storage"
|
||||||
|
- "@chill.main.form.data_transformer.center_transformer"
|
||||||
|
tags:
|
||||||
|
- { name: form.type, alias: center }
|
||||||
|
|
||||||
|
chill.main.form.type.composed_role_scope:
|
||||||
|
class: Chill\MainBundle\Form\Type\ComposedRoleScopeType
|
||||||
|
arguments:
|
||||||
|
- "@chill.main.helper.translatable_string"
|
||||||
|
- "@chill.main.role_provider"
|
||||||
|
tags:
|
||||||
|
- { name: form.type, alias: composed_role_scope }
|
||||||
|
|
||||||
|
|
||||||
|
chill.main.form.type.postal_code_type:
|
||||||
|
class: Chill\MainBundle\Form\Type\PostalCodeType
|
||||||
|
arguments:
|
||||||
|
- "@chill.main.helper.translatable_string"
|
||||||
|
tags:
|
||||||
|
- { name: form.type }
|
||||||
|
|
||||||
|
chill.main.form.type.export:
|
||||||
|
class: Chill\MainBundle\Form\Type\Export\ExportType
|
||||||
|
arguments:
|
||||||
|
- "@chill.main.export_manager"
|
||||||
|
tags:
|
||||||
|
- { name: form.type }
|
||||||
|
|
||||||
|
chill.main.form.pick_formatter_type:
|
||||||
|
class: Chill\MainBundle\Form\Type\Export\PickFormatterType
|
||||||
|
arguments:
|
||||||
|
- "@chill.main.export_manager"
|
||||||
|
tags:
|
||||||
|
- { name: form.type }
|
||||||
|
|
||||||
|
chill.main.form.pick_centers_type:
|
||||||
|
class: Chill\MainBundle\Form\Type\Export\PickCenterType
|
||||||
|
arguments:
|
||||||
|
- "@security.token_storage"
|
||||||
|
- "@chill.main.export_manager"
|
||||||
|
- "@chill.main.security.authorization.helper"
|
||||||
|
tags:
|
||||||
|
- { name: form.type }
|
||||||
|
|
||||||
|
chill.main.form.formatter_type:
|
||||||
|
class: Chill\MainBundle\Form\Type\Export\FormatterType
|
||||||
|
arguments:
|
||||||
|
- "@chill.main.export_manager"
|
||||||
|
tags:
|
||||||
|
- { name: form.type }
|
||||||
|
|
||||||
|
chill.main.form.date_type:
|
||||||
|
class: Chill\MainBundle\Form\Type\ChillDateType
|
||||||
|
tags:
|
||||||
|
- { name: form.type }
|
Loading…
x
Reference in New Issue
Block a user