Problem/Motivation
We are trying to intergrate select2 but with the empty value (usually in drupal it's represented with _none) the title field is not showing up as a selectable option using https://www.drupal.org/project/select2_all
Steps to reproduce
- Enable select2_all and name modules.
- Add a name field with title options
- View the form to see the missing options
Proposed resolution
Instead of using empty string use the _none
Remaining tasks
User interface changes
API changes
Data model changes
| Comment | File | Size | Author |
|---|---|---|---|
| #10 | name_none_placeholder-3384140-10.patch | 682 bytes | tkiehne |
Issue fork name-3384140
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 #3
joelpittetComment #4
joelpittetWe found out that my MR/patch stored the
_nonevalue which was not intended though I would have thought the nice tests here would catch that, nevertheless I updated it to strip it out similar to:core/lib/Drupal/Core/Field/Plugin/Field/FieldWidget/OptionsWidgetBase.php:110But considering NameWidget doesn't extend from that (and doesn't need to) I just grabbed the part that was needed.
Comment #7
heddnThanks for your contributions.
Comment #8
tkiehne commentedI'd hate to burst y'alls bubble here, but the filtering in the NameWidget uses array_search() which only returns the first key:
https://www.php.net/manual/en/function.array-search.php
So, if we have both title and generational in the form and the user leaves both blank, only one of these is going to get massaged to remove the "_none".
Should be something like this instead:
Comment #9
derekw commentedI confirm -- I am seeing the behavior described in #8 and a blank "Generational" field is being rendered as _none by the default name formatter.
Comment #10
tkiehne commentedI had to work up a patch to deploy a site tonight - here it is if it helps while waiting for a new release
Comment #11
heddn@tkiehne can you post a new issue with that in it and link it here? I'd like to get this fixed pretty quickly.
Comment #12
tkiehne commented#3491471 created