Overview

#3487484: Save page data form values in application state with support for undo/redo introduced handling radios, but it had done so with a fragile implementation using a function named `getNameAttributeBasedOnId()` (see `ui/src/components/form/formUtil.ts`). Let's improve this, but preferably after #3497669: Extend test coverage for checkboxes + radios is done.

Proposed resolution

Suggested by @larowlan:

  1. Override template_preprocess_radios in the XB module;
  2. Put $variables['element']['#name'] into $variables['attributes']['data-name'];
  3. Refactor the JS to pluck data-name if there's no name attribute — see where getNameAttributeBasedOnId() is used to find out where this needs to happen.

Comments

balintbrews created an issue. See original summary.

balintbrews’s picture

balintbrews’s picture

Title: [PP-2] Improve handling of radios in Redux-integrated field widgets » [PP-1] Improve handling of radios in Redux-integrated field widgets
jessebaker’s picture

Priority: Minor » Normal
Issue tags: +stable blocker
larowlan’s picture