Problem/Motivation
The icon picker field, when set to "Optional," offers an "empty" option. However, selecting "empty" and saving the content results in the first option being selected instead. Additionally, the "empty" option is not present within the input field itself, as revealed by inspecting the code..
Proposed resolution
In the file Element/FontIconpicker.php, line 34 introduces the processFontIconpicker function. However, this function executes after the processSelect function, preventing the "empty" option from being added to the input field.
To address this issue, modify line 34 as follows:
$info['#process'] = array_merge([[$class, 'processFontIconpicker']], $info['#process']);
This code effectively merges the processFontIconpicker function into the existing #process array, ensuring it runs before processSelect. This, in turn, guarantees the successful addition of the "empty" option to the input field.
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | issues-3425667-Unable-to-select-the-empty-option.patch | 561 bytes | viren18febs |
Issue fork font_iconpicker-3425667
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
viren18febs commentedI have added a patch for this , please review.
Comment #3
chiragp185 commentedComment #5
s3b0un3tHello,
Thank you to all three for this feedback, the patch and the tests.
I tested it on my side and everything seems ok.
I apply the patch and generate a new release.
Comment #6
s3b0un3t