Field type: Boolean
When set non-required filter on the Boolean field the -Any- choice does not stick.
On loading/running the saved view (without any query params) it always shows True or Fallse; -Any-is available, but not selected by default as desired.
Next time open up the Views UI config for that filter it always shows one of True or False, never -Any- as previously.
Snippet from views Single item YAML export:
field_d8_wishlist_value:
id: field_d8_wishlist_value
table: node__field_d8_wishlist
field: field_d8_wishlist_value
relationship: none
group_type: group
admin_label: ''
operator: '='
value: true
group: 1
exposed: true
expose:
operator_id: ''
label: 'On Webel''s D8 Wishlist'
description: ''
use_operator: false
operator: field_d8_wishlist_value_op
identifier: field_d8_wishlist_value
required: false
remember: true
multiple: false
remember_roles:
anonymous: anonymous
authenticated: authenticated
administrator: '0'
author: '0'
developer: '0'
is_grouped: false
Note value: true although -Any was chosen and applied then view saved.
Comments
Comment #2
dawehnerThank you for reporting this issue! Small improvements matter!
After some hour of debugging that problem I figured out that
\Drupal\Core\Render\Element\Radio::preRenderRadioseems to have a bug.If you check out the HTML of the form correctly, you'll see that both the All and the False element is marked with
checked="checked". This is caused by the following lineif (isset($element['#return_value']) && $element['#value'] !== FALSE && $element['#value'] == $element['#return_value']) {in thispreRenderRadiomethod.I think the right method would be to check whether the value is a boolean/integer, casts them to their type and then do a "===", but I'm not sure about the correct fix.
Comment #3
mkalkbrennerI just ran into this issue with the latest core and Search API. I exposed a filter on the boolean content translation outdated flag.
Comment #4
mkalkbrennerComment #5
mkalkbrennerComment #7
mkalkbrennerthis issue will be solved by #1381140: A #default_value = 0 for #type radios checks all radios