mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-14 06:14:23 +00:00
fix bug : CFChoice was not rendered correctly with _other option
This commit is contained in:
parent
65b8499458
commit
a925533fc8
@ -185,11 +185,8 @@ class CustomFieldChoice implements CustomFieldInterface
|
|||||||
public function render($value, CustomField $customField)
|
public function render($value, CustomField $customField)
|
||||||
{
|
{
|
||||||
//extract the data. They are under a _choice key if they are stored with allow_other
|
//extract the data. They are under a _choice key if they are stored with allow_other
|
||||||
$data = (isset($value['_choices'])) ? $value['_choices'] :
|
$data = (isset($value['_choices'])) ? $value['_choices'] : $value;
|
||||||
is_null($value) ? array() : $value;
|
$selected = (is_array($data)) ? $data : array($data);
|
||||||
|
|
||||||
$selected = (is_array($data)) ? $data : array($data);
|
|
||||||
|
|
||||||
$choices = $customField->getOptions()[self::CHOICES];
|
$choices = $customField->getOptions()[self::CHOICES];
|
||||||
|
|
||||||
if (in_array('_other', $selected)){
|
if (in_array('_other', $selected)){
|
||||||
|
@ -5,15 +5,15 @@
|
|||||||
{%- if is_selected -%}
|
{%- if is_selected -%}
|
||||||
<li class="{% if is_selected or expanded == 1 %} selected {% endif %}">
|
<li class="{% if is_selected or expanded == 1 %} selected {% endif %}">
|
||||||
{%- if is_selected -%}
|
{%- if is_selected -%}
|
||||||
<i class="fa fa-check-square-o"></i>
|
<i class="fa fa-check-square-o"></i>
|
||||||
{%- else -%}
|
{%- else -%}
|
||||||
<i class="fa fa-square-o"></i>
|
<i class="fa fa-square-o"></i>
|
||||||
|
{%- 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 -%}
|
{%- 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 -%}
|
|
||||||
<span class="other">{{ 'Other value'|trans }} :</span> {{ choice['name'] }}
|
|
||||||
{%- endif -%}
|
|
||||||
</li>
|
</li>
|
||||||
{%- endif -%}
|
{%- endif -%}
|
||||||
{%- endfor -%}
|
{%- endfor -%}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user