Upgrading seeds_widgets from version 1.x to 2.0.x and identified that the data structure has changed significantly, requiring specialized update hooks to prevent data loss.
Summary of Changes:
The 2.0.x branch introduces architectural changes:
Widget Settings Storage: Moves from individual fields (field_seeds_widget_desktop, field_seeds_widget_modal_title, etc.) to a single serialized field_widget_settings field.
Formatter IDs: Renames widget types (e.g., grid -> seeds_widgets_grid).
CSS Class Normalization: Updates class formats (e.g., converting col-md-12 col-sm-12 to col-md-12).
Proposed Solution:
implemented hook_update_N functions in
seeds_widgets.install
to automate this migration:
seeds_widgets_update_9001: Creates the new field_widget_settings storage (using string_long type for serialized data).
seeds_widgets_update_9002: Updates field_seeds_widget_types to use a dynamic allowed values function, replacing static choices.
seeds_widgets_update_9003: Maps old widget type values to new formatter IDs (e.g. grid -> seeds_widgets_grid).
seeds_widgets_update_9004: Migrates actual setting values (desktop/tablet/mobile grid classes, modal titles) into the new serialized field, ensuring all translations are preserved.
seeds_widgets_update_9005: Cleans up by removing the legacy fields after successful migration.
seeds_widgets_update_9006: Normalizes CSS class strings to match the new formatter expectations.
Comments
Comment #4
ahmad-alyasaki commented