Problem/Motivation
The SearchApiNumeric ViewsField plugin init method does not handle correctly every situations. Works well for Plural settings are not saved for custom fields declared with mapping to search_api_numeric.
Steps to reproduce
- Create a custom field extending IntegerItem
- Subscribe to SearchApiEvents::MAPPING_VIEWS_FIELD_HANDLERS to map it to search_api_numeric
- Add the field to a search api view
- Enable format plural and add singular and plural strings
- Save options
- options are not saved properly
Proposed resolution
The condition should check the format_plural_values is not empty instead of checking if it is set.
Tested with indexed field, entity discovered field and computed field.
Issue fork search_api-3558388
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
drunken monkeyThanks a lot for reporting this!
I haven’t completely gone through your steps to reproduce but it does seem quite obvious that this check is pretty useless when we define the
'format_plural_values'option ourselves with default value[].For this reason, I also think this doesn‘t really need test coverage.
So, merged.
Thanks again!