Hi,
Not sure if that's a typo, but the list types actually supported by MultiSelect include 'list_number' instead of 'list_interger', which is the field type implemented by core "List (integer)" fields.
Not sure if the correct fix for multiselect_field_widget_info() would be one or the other:
Replacing 'list_number' by 'list_integer':
- 'field types' => array('list', 'list_text', 'list_number', 'node_reference', 'taxonomy_term_reference', 'user_reference', 'entityreference'),
+ 'field types' => array('list', 'list_text', 'list_integer', 'node_reference', 'taxonomy_term_reference', 'user_reference', 'entityreference'),
or adding 'list_integer' to the list:
- 'field types' => array('list', 'list_text', 'list_number', 'node_reference', 'taxonomy_term_reference', 'user_reference', 'entityreference'),
+ 'field types' => array('list', 'list_text', 'list_integer', 'list_number', 'node_reference', 'taxonomy_term_reference', 'user_reference', 'entityreference'),
For the moment, we've fixed this in a custom module, with a little implementation of hook_field_widget_info_alter():
/**
* Implements hook_field_widget_info_alter().
*/
function MYMODULE_field_widget_info_alter(&$info) {
if (!in_array('list_integer', $info['multiselect']['field types'])) {
$info['multiselect']['field types'][] = 'list_integer';
}
}
Hope that helps!
Comments
Comment #1
skylord commentedWorks OK for a long time. Wonder it's still not fixed...
Comment #2
klonosTL;DR: This is simply a matter of whether you want things to not break in older D7 sites that have started as pre-release/dev sites before Drupal 7 was officially released, and have not been updated properly when D7.0 was officially released.
As part of #932502: Changing allowed values in "List" fields, an update hook was introduced, which renamed field types from
'list'to'list_integer', and from'list_number'to'list_float'. So the only sites where'list_number'will make sense are the ones where the corelist_update_7001()hook was not run (this hook exists since D7.0).Bottom line is that if you want things to work properly, then the only types used in properly updated D7 sites are
'list_integer'and'list_float'- there's no'list'or'list_number'any more - these were a thing in D6 I guess, and only available in D7 RC2 if we go by the inline comment here.I hope the above helps unblock this issue here. I will see if I can provide a PR for it.
Comment #4
klonosHere's a PR for review: https://git.drupalcode.org/project/multiselect/-/merge_requests/1
Comment #5
ameymudras commentedTested with 7.x-1.x
- The changes are simple and fix the issue mentioned
- After using the MR the multi-select supports list_number and list_float types
- No issues identified with code review
- No issues in the log
Marking as RTBC
Comment #6
mparker17multiselect-7.x-1.x is no longer supported, because Drupal 7 is no longer supported.
Can you confirm if this is still an issue in multiselect-2.0.0-beta4?
I'm going to mark this issue as "Postponed (maintainer needs more info)"... but when you answer, please change it back to "Active". If there is no reply in ~6 months, then I will mark this issue as "Closed (outdated)". Thank you in advance for your understanding and patience as I try to keep this module's issue queue clear.