diff --git a/Controller/CustomFieldsGroupController.php b/Controller/CustomFieldsGroupController.php index 3c7e0f3ef..f31edd4df 100644 --- a/Controller/CustomFieldsGroupController.php +++ b/Controller/CustomFieldsGroupController.php @@ -154,12 +154,36 @@ class CustomFieldsGroupController extends Controller if (!$entity) { throw $this->createNotFoundException('Unable to find CustomFieldsGroup entity.'); } + + $options = $this->getOptionsAvailable($entity->getEntity()); return $this->render('ChillCustomFieldsBundle:CustomFieldsGroup:show.html.twig', array( 'entity' => $entity, - 'create_field_form' => $this->createCreateFieldForm($entity)->createView() + 'create_field_form' => $this->createCreateFieldForm($entity)->createView(), + 'options' => $options )); } + + /** + * Return an array of available key option for custom fields group + * on the given entity + * + * @param string $entity the entity to filter + */ + private function getOptionsAvailable($entity) + { + $options = $this->getParameter('chill_custom_fields.' + . 'customizables_entities'); + + foreach($options as $key => $definition) { + if ($definition['class'] == $entity) { + foreach ($definition['options'] as $key => $value) { + yield $key; + } + } + } + // [$entity->getEntity()]; + } /** * Displays a form to edit an existing CustomFieldsGroup entity. diff --git a/Resources/translations/messages.fr.yml b/Resources/translations/messages.fr.yml index 2eb85c380..ab8cd4877 100644 --- a/Resources/translations/messages.fr.yml +++ b/Resources/translations/messages.fr.yml @@ -18,6 +18,7 @@ Add a new field: Ajouter un champ personnalisé ordering: ordre label_field: label du champ active: actif +No value defined for this option: Pas de valeur pour cette option CustomFieldsGroup edit: Edition d'un groupe de champs personnalisé diff --git a/Resources/views/CustomFieldsGroup/show.html.twig b/Resources/views/CustomFieldsGroup/show.html.twig index bdbe2bad5..d2f9d4e33 100644 --- a/Resources/views/CustomFieldsGroup/show.html.twig +++ b/Resources/views/CustomFieldsGroup/show.html.twig @@ -16,7 +16,7 @@ #} {% extends "ChillCustomFieldsBundle::Admin/layout.html.twig" %} -{% block title%}{{ 'CustomFieldsGroup details'|trans }}{% endblock %} +{% block title %}{{ 'CustomFieldsGroup details'|trans }}{% endblock %} {% block admin_content %}