diff --git a/CustomFields/CustomFieldChoice.php b/CustomFields/CustomFieldChoice.php index ca4af6a9e..61508b36e 100644 --- a/CustomFields/CustomFieldChoice.php +++ b/CustomFields/CustomFieldChoice.php @@ -185,11 +185,8 @@ class CustomFieldChoice implements CustomFieldInterface public function render($value, CustomField $customField) { //extract the data. They are under a _choice key if they are stored with allow_other - $data = (isset($value['_choices'])) ? $value['_choices'] : - is_null($value) ? array() : $value; - - $selected = (is_array($data)) ? $data : array($data); - + $data = (isset($value['_choices'])) ? $value['_choices'] : $value; + $selected = (is_array($data)) ? $data : array($data); $choices = $customField->getOptions()[self::CHOICES]; if (in_array('_other', $selected)){ diff --git a/Resources/views/CustomFieldsRendering/choice.html.twig b/Resources/views/CustomFieldsRendering/choice.html.twig index 937897d94..f5bd582d2 100644 --- a/Resources/views/CustomFieldsRendering/choice.html.twig +++ b/Resources/views/CustomFieldsRendering/choice.html.twig @@ -5,15 +5,15 @@ {%- if is_selected -%}
  • {%- if is_selected -%} - +   {%- else -%} - +   + {%- endif -%} + {%- if choice['slug'] is not same as('_other') -%} + {{ choice['name'][app.request.locale]|default(choice['name'][locale]|default('Not available in your language'|trans)) }} + {%- else -%} + {{ choice['name'] }} {%- endif -%} - {%- if choice['slug'] is not same as('_other') -%} - {{ choice['name'][app.request.locale]|default(choice['name'][locale]|default('Not available in your language'|trans)) }} - {%- else -%} - {{ 'Other value'|trans }} : {{ choice['name'] }} - {%- endif -%}
  • {%- endif -%} {%- endfor -%}