Skip to content

Commit

Permalink
avoid rendering the ChoiceType separator if all choices are `pref…
Browse files Browse the repository at this point in the history
…erred_choices`
  • Loading branch information
craue committed Jul 26, 2011
1 parent fe1f42f commit c558b78
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
Expand Up @@ -57,7 +57,9 @@
{% if preferred_choices|length > 0 %}
{% set options = preferred_choices %}
{{ block('widget_choice_options') }}
<option disabled="disabled">{{ separator }}</option>
{% if choices|length > 0 %}
<option disabled="disabled">{{ separator }}</option>
{% endif %}
{% endif %}
{% set options = choices %}
{{ block('widget_choice_options') }}
Expand Down
Expand Up @@ -13,7 +13,9 @@
<?php if (null !== $empty_value): ?><option value=""><?php echo $view->escape($view['translator']->trans($empty_value)) ?></option><?php endif; ?>
<?php if (count($preferred_choices) > 0): ?>
<?php echo $view['form']->renderBlock('choice_options', array('options' => $preferred_choices)) ?>
<option disabled="disabled"><?php echo $separator ?></option>
<?php if (count($choices) > 0): ?>
<option disabled="disabled"><?php echo $separator ?></option>
<?php endif ?>
<?php endif ?>
<?php echo $view['form']->renderBlock('choice_options', array('options' => $choices)) ?>
</select>
Expand Down

0 comments on commit c558b78

Please sign in to comment.