Julien Fastré 4f13ec6959 add a custom field long choice basic
The `custom field long choice` aim to provide a way to deal with choices
with a big possibilities.

The `custom field long choice` allow :
- to persist different options in the database ;
- each option has a key, a text (translatable string), and eventually a
  parent, and an internal_key
- every key can be activate or not. If the parent is inactivated, all
  childs are inactivated
- the internal key have two purposes :
    - link to an external csv file, with their own key ;
    - add a special class to results, to allow custom layout.

Currently, the field exists, but some elements are missing :

- a script for CSV import
- possibility to select multiple items
- edition of options
- handle of option without parents
- tests are missing
2015-12-11 11:43:39 +01:00

126 lines
4.7 KiB
YAML

parameters:
# cl_custom_fields.example.class: Chill\CustomFieldsBundle\Example
services:
chill.custom_field.provider:
class: Chill\CustomFieldsBundle\Service\CustomFieldProvider
call:
- [setContainer, ["@service_container"]]
chill.custom_field.custom_field_choice_type:
class: Chill\CustomFieldsBundle\Form\CustomFieldType
arguments:
- "@chill.custom_field.provider"
- "@doctrine.orm.entity_manager"
tags:
- { name: 'form.type', alias: 'custom_field_choice' }
chill.custom_field.custom_fields_group_type:
class: Chill\CustomFieldsBundle\Form\CustomFieldsGroupType
arguments:
- %chill_custom_fields.customizables_entities%
- "@translator"
tags:
- { name: 'form.type', alias: 'custom_fields_group' }
chill.custom_field.custom_field_type:
class: Chill\CustomFieldsBundle\Form\Type\CustomFieldType
arguments:
- "@doctrine.orm.entity_manager"
- "@chill.custom_field.provider"
tags:
- { name: 'form.type', alias: 'custom_field' }
chill.custom_field.text:
class: Chill\CustomFieldsBundle\CustomFields\CustomFieldText
arguments:
- "@request_stack"
- "@templating"
- "@chill.main.helper.translatable_string"
tags:
- { name: 'chill.custom_field', type: 'text' }
chill.custom_field.number:
class: Chill\CustomFieldsBundle\CustomFields\CustomFieldNumber
arguments:
- "@templating"
- "@chill.main.helper.translatable_string"
tags:
- { name: 'chill.custom_field', type: 'number' }
chill.form_extension.post_text_integer:
class: Chill\CustomFieldsBundle\Form\Extension\PostTextIntegerExtension
tags:
- { name: form.type_extension, alias: 'integer' }
chill.form_extension.post_text_number:
class: Chill\CustomFieldsBundle\Form\Extension\PostTextNumberExtension
tags:
- { name: form.type_extension, alias: 'number' }
chill.custom_field.choice:
class: Chill\CustomFieldsBundle\CustomFields\CustomFieldChoice
arguments:
- "@request_stack"
- "@translator.default"
- "@templating"
- "@chill.main.helper.translatable_string"
tags:
- { name: 'chill.custom_field', type: 'choice' }
chill.custom_field.custom_fields_group_linked_custom_fields:
class: Chill\CustomFieldsBundle\Form\Type\LinkedCustomFieldsType
arguments:
- "@chill.main.helper.translatable_string"
tags:
- { name: form.type, alias: custom_fields_group_linked_custom_fields }
chill.custom_field.custom_fields_title_type:
class: Chill\CustomFieldsBundle\Form\Type\CustomFieldsTitleType
tags:
- { name: 'form.type', alias: 'custom_field_title' }
chill.custom_field.title:
class: Chill\CustomFieldsBundle\CustomFields\CustomFieldTitle
arguments:
- "@request_stack"
- "@templating"
- "@chill.main.helper.translatable_string"
tags:
- { name: 'chill.custom_field', type: 'title' }
chill.custom_field.helper:
class: Chill\CustomFieldsBundle\Service\CustomFieldsHelper
arguments:
- "@doctrine.orm.entity_manager"
- "@chill.custom_field.provider"
chill.custom_field.twig.custom_fields_rendering:
class: Chill\CustomFieldsBundle\Templating\Twig\CustomFieldRenderingTwig
calls:
- [setContainer, ["@service_container"]]
tags:
- { name: twig.extension }
chill.custom_field.twig.custom_fields_group_rendering:
class: Chill\CustomFieldsBundle\Templating\Twig\CustomFieldsGroupRenderingTwig
calls:
- [setContainer, ["@service_container"]]
tags:
- { name: twig.extension }
chill.custom_field.custom_field_long_choice:
class: Chill\CustomFieldsBundle\CustomFields\CustomFieldLongChoice
arguments:
- "@chill.custom_field.custom_field_long_choice_option_repository"
- "@chill.main.helper.translatable_string"
- "@templating"
tags:
- { name: 'chill.custom_field', type: 'long_choice' }
chill.custom_field.custom_field_long_choice_option_repository:
class: Chill\CustomFieldsBundle\EntityRepository\CustomFieldLongChoice\OptionRepository
factory: ["@doctrine", getRepository]
arguments:
- "Chill\CustomFieldsBundle\Entity\CustomFieldLongChoice\Option"