isset($old_slide['image_path']) ? $old_slide['image_path'] : '', 'title' => isset($old_slide['image_title']) ? $old_slide['image_title'] : '', 'description' => array( 'value' => isset($old_slide['image_description']) ? $old_slide['image_description'] : '', 'format' => 'plain_text', ), 'url' => isset($old_slide['image_url']) ? $old_slide['image_url'] : '', 'visibility' => isset($old_slide['image_visibility']) ? $old_slide['image_visibility'] : '*', 'transition' => isset($old_slide['image_transition']) ? $old_slide['image_transition'] : '', 'weight' => isset($old_slide['image_weight']) ? $old_slide['image_weight'] : 1, 'published' => isset($old_slide['image_published']) ? $old_slide['image_published'] : TRUE, 'delete' => isset($old_slide['image_delete']) ? $old_slide['image_delete'] : '', ); } // Save the new settings variable_set('nivo_slider_banner_settings', $new_slider); return t('Updated existing slide property names and added new properties.'); } /** * Remove obsolete variables. */ function nivo_slider_update_7003() { variable_del('nivo_slider_caption_opacity'); variable_del('nivo_slider_keyboard_navigation'); return t('Removed obsolete variables.'); } /** * Convert existing slide URIs to file IDs. */ function nivo_slider_update_7004() { // Get the current slider settings $slider = variable_get('nivo_slider_banner_settings', array()); // Process each of the slides foreach ($slider as &$slide) { // If the slide has a URI continue processing, otherwise delete the slide if (isset($slide['path'])) { // Find the URI of the current slide $uri = $slide['path']; // Find the file ID of the file with the URI $fid = db_query('SELECT fid FROM {file_managed} WHERE uri = :uri', array(':uri' => $uri))->fetchField(); // If the ID of the slide's image file can be found then load the file // otherwise, delete the slide if (!empty($fid)) { // Load the file with the file ID $file = file_load($fid); // Add the file ID to the slide settings $slide['fid'] = $file->fid; // Remove the existing path setting unset($slide['path']); } else { unset($slide); } } else { unset($slide); } } // Save the updated settings variable_set('nivo_slider_banner_settings', $slider); return t('Converted existing slide URIs to file IDs.'); } /** * Remove obsolete variables. */ function nivo_slider_update_7005() { variable_del('nivo_slider_directional_navigation_hide'); return t('Removed obsolete variables.'); }