I have just upgraded to the new 2.0 release of chosen, and noticed the change in #2213231: Make it possible to force-disable Chosen for a field widget.

All our field instances are exported to code currently, and the change of '' (blank string) to 0 does not trigger a features difference. Thus when features revert (even with '' in the export), it appears in the database as 0.

This is obviously less than ideal, as it effectively removes chosen from all select lists on all node fields.

Attached is a simple patch to alter the empty value of 'no preference' to -1, this is enough to force features to revert correctly, and store the correct value in the database.

CommentFileSizeAuthor
chosen-empty-preference.patch1.43 KBwiifm
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

rogerpfaff’s picture

I'm not sure if this patch will work after you already updated you chosen module before this change. The system version of the module will already be 2003 and if you change it afterwards this will never be applied to you configuration I guess.

rogerpfaff’s picture

Besides the previously mentioned concerns the changes work as desired and the fields are rendered correctly after re-saving the Content

rogerpfaff’s picture

As a further remark. If you have Chosen Ajax installed too then you might want to take a look at #2218863 if your settings behave not like you want.