diff --git a/Controller/CustomFieldController.php b/Controller/CustomFieldController.php index df23c6e40..98b8b1c96 100644 --- a/Controller/CustomFieldController.php +++ b/Controller/CustomFieldController.php @@ -159,7 +159,7 @@ class CustomFieldController extends Controller $editForm = $this->createEditForm($entity, $entity->getType()); $deleteForm = $this->createDeleteForm($id); - + return $this->render('ChillCustomFieldsBundle:CustomField:edit.html.twig', array( 'entity' => $entity, 'edit_form' => $editForm->createView(), diff --git a/CustomFields/CustomFieldChoice.php b/CustomFields/CustomFieldChoice.php index a20eb4814..304b33ef3 100644 --- a/CustomFields/CustomFieldChoice.php +++ b/CustomFields/CustomFieldChoice.php @@ -136,7 +136,8 @@ class CustomFieldChoice implements CustomFieldInterface 'choices' => array( 1 => 'Multiple', 0 => 'Unique'), - 'empty_data' => 0 + 'empty_data' => 0, + 'label' => 'Multiplicity' )) ->add(self::EXPANDED, 'choice', array( 'expanded' => true, @@ -144,7 +145,8 @@ class CustomFieldChoice implements CustomFieldInterface 'choices' => array( 1 => 'Expanded', 0 => 'Non expanded'), - 'empty_data' => 0 + 'empty_data' => 0, + 'label' => 'Choice display' )) ->add(self::ALLOW_OTHER, 'choice', array( 'label' => 'Allow other', diff --git a/Resources/translations/messages.fr.yml b/Resources/translations/messages.fr.yml index ab8cd4877..d9cf635fd 100644 --- a/Resources/translations/messages.fr.yml +++ b/Resources/translations/messages.fr.yml @@ -2,7 +2,7 @@ 'Other value': 'Autre valeur' 'None': 'Pas spécifié' - +#customfieldsgroup administration CustomFieldsGroup list: Groupes de champs personnalisés CustomFieldsGroup creation: Nouveau groupe de champs personnalisés Entity: Entité @@ -26,3 +26,24 @@ CustomFieldsGroup edit: Edition d'un groupe de champs personnalisé Custom fields configuration: Champs personnalisés CustomFields List: Liste des champs personnalisés CustomFields Groups: Groupe de champs personnalisés + +#customfield administration +CustomField edit: Modification d'un champ personnalisé +General informations: Informations générales +Options: Options +Custom fields group: Groupe de champ personnalisé +Ordering: Ordre d'apparition +Back to the group: Retour au groupe de champs personnalisé + +#custom field choice +Multiplicity: Multiplicité +Multiple: Multiple +Unique: Un seul choix possible +Choice display: Affichage des choix +Expanded: Choix étendus (boutons radio) +Non expanded: Choix rassemblés +Allow other: Autoriser une autre valeur +No: Non +Yes: Oui +Other value label (empty if use by default): Label du champ "autre valeur" +Choices: Choix diff --git a/Resources/views/CustomField/edit.html.twig b/Resources/views/CustomField/edit.html.twig index bcc2e5d88..9b32ab809 100644 --- a/Resources/views/CustomField/edit.html.twig +++ b/Resources/views/CustomField/edit.html.twig @@ -16,17 +16,33 @@ #} {% extends "ChillCustomFieldsBundle::Admin/layout.html.twig" %} -{% block admin_content %} -

CustomField edit

+{% block title %}{{ 'CustomField edit'|trans }}{% endblock title %} - {{ form(edit_form) }} +{% block admin_content %} +

{{ 'CustomField edit'|trans }}

+ +

{{ 'General informations'|trans }}

+ {{ form_start(edit_form) }} + {{ form_row(edit_form.name) }} + {{ form_row(edit_form.active) }} + {% if edit_form.customFieldsGroup is defined %} + {{ form_row(edit_form.customFieldsGroup) }} + {% endif %} + {{ form_row(edit_form.ordering) }} + {% if edit_form.options is not empty %} +

{{ 'Options'|trans }}

+ {% for option in edit_form.options %} + {{ form_row(option) }} + {% endfor %} + {% endif %} + {{ form_row(edit_form.submit, {'attr': { 'class': 'sc-button btn-update' } } ) }} + {{ form_end(edit_form) }} {% endblock %} diff --git a/Resources/views/Form/fields.html.twig b/Resources/views/Form/fields.html.twig index 76ec0cb5c..3a23a5adf 100644 --- a/Resources/views/Form/fields.html.twig +++ b/Resources/views/Form/fields.html.twig @@ -32,10 +32,19 @@ {% endblock cf_choices_list_widget %} -{# render the possibility to add different elements in a choice list #} -{% block cf_choices_widget %} +{# CFChoice : render the different elements in a choice list #} +{% block cf_choices_row %} +

{{ 'Choices'|trans }}

- {{ form(form) }} + + {% for choice in form %} + + {% endfor %} +
+ {{ form_row(choice.name) }} +
+ + {# we use javascrit to add an additional element. All functions are personnalized with the id ( = form.vars.id) #} -{% endblock cf_choices_widget %} +{% endblock cf_choices_row %} {% block choice_with_other_widget %}