You are here

function fivestar_update_7205 in Fivestar 7.2

Rename fivestar 'select' widget to 'fivestar_select'.

See also

http://drupal.org/node/1285456

File

./fivestar.install, line 218
Install, update, and uninstall functions the Fivestar module.

Code

function fivestar_update_7205() {
  $fields = field_read_fields(array(
    'type' => 'fivestar',
  ));
  foreach ($fields as $field) {

    // Iterate through the instances of the field.
    $instances = field_read_instances(array(
      'field_name' => $field['field_name'],
    ));
    foreach ($instances as $instance) {

      // If the widget type is select, lets change it.
      if ($instance['widget']['type'] == 'select') {
        $instance['widget']['type'] = 'fivestar_select';

        // Update the instance.
        field_update_instance($instance);
      }
    }
  }
}