function slick_update_7302 in Slick Carousel 7.3
Rebuild the optionsets and registry to migrate from Slick 2.x to 3.x.
Tasks:<br>
- Convert Slick optionsets from stdClass to \Drupal\slick\Entity\Slick.<br>
File
- ./
slick.install, line 218 - Installation actions for Slick.
Code
function slick_update_7302() {
ctools_include('export');
$run_update = FALSE;
foreach (Slick::loadMultiple() as &$optionset) {
if ($optionset->name == 'default') {
continue;
}
// Move some general options into the main settings to be usable at JS.
$settings =& $optionset->options['settings'];
// Marks the update to run when it has old references.
if (isset($optionset->options['general']) && ($general = $optionset->options['general'])) {
$settings['downArrow'] = $general['goodies']['arrow-down'];
$settings['randomize'] = $general['goodies']['random'];
$settings['downArrowTarget'] = $general['arrow_down_target'];
$settings['downArrowOffset'] = $general['arrow_down_offset'];
// Move optimized out from the option to top level field.
$optimized = isset($optionset->optimized) ? $optionset->optimized : 0;
$optimized = isset($optionset->options['optimized']) ? $optionset->options['optimized'] : $optimized;
$collection = isset($optionset->collection) ? $optionset->collection : '';
unset($optionset->options['optimized']);
$optionset->collection = $collection;
$optionset->optimized = $optimized;
// Removed non-supported options under general, some moved above.
unset($optionset->options['general']);
ctools_export_crud_save(Slick::TABLE, $optionset);
$run_update = TRUE;
}
}
if ($run_update) {
// Rebuild CTools cache for the Slick::TABLE.
ctools_export_load_object_reset(Slick::TABLE);
}
// Repeat rebuilding theme registry.
drupal_theme_rebuild();
// Repeat rebuilding old Slick UI class registry.
registry_rebuild();
}