You are here

function panopoly_widgets_update_7024 in Panopoly Widgets 7

Update field instance settings for duration fields on Spotlight widgets.

File

./panopoly_widgets.install, line 525
An installation file for Panopoly Widgets

Code

function panopoly_widgets_update_7024() {

  // Remove legacy field if it's still around.
  if ($instance_info = field_info_instance('fieldable_panels_pane', 'field_spotlight_rotation_time', 'spotlight')) {
    field_delete_instance($instance_info);
  }

  // Make the default value 5 and mark as required.
  if ($instance_info = field_info_instance('fieldable_panels_pane', 'field_basic_spotlight_duration', 'spotlight')) {
    $instance_info['default_value'] = array(
      0 => array(
        'value' => 5,
      ),
    );
    $instance_info['required'] = 1;
    field_update_instance($instance_info);
  }
}