Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Steps to reproduce
- install module and enter site id
- add path in pages tracking scope section, select 'Show for the listed pages' option and save form
Results
- No pages negate option is selected after form save.
Expected Results
- Form should show previously selected 'Show for the listed pages' option.
Comments
Comment #1
jasonawantHi,
I think I've tracked down this issue to how the radio form element is rendered. Also, this is the same UX for the block page visibility section. I've changed the priority to minor, as the default condition negate value is false, so the condition still evaluates correctly, However, it's rather poor UX.
In \Drupal\Core\Render\Element\Radio::preRenderRadio(), see
As the form option is false, this if statement is false and checked attribute is not set appropriately. Need to dig in to see if this is a core bug in radio rendering or in block visibility with how we manage this false option.
Comment #2
jasonawantHere's a bit more info that I've tracked down related to the specific logic in the radio render.
- git history on 8.x branch does not reveal much about this logic.
- looks like this logic was added D7 theme_radio() when compared to D6 theme_radio(), see https://api.drupal.org/api/drupal/includes%21form.inc/function/theme_rad...
- logic was added here > https://www.drupal.org/node/971120#comment-3706168
Comment #4
jasonawantAlright, so I've posted a drupal core bug report here > https://www.drupal.org/node/2450637.
Until that's picked up, I've committed a fix that shuffles the negate #default_option from a boolean to an integer as a temp work-around