You are here

function soundcloudfield_update_7001 in SoundCloud field 7

Remove Flash-player-specific settings from the field instances.

File

./soundcloudfield.install, line 75
Install, update and uninstall functions for the SoundCloud field module.

Code

function soundcloudfield_update_7001() {
  $instances = field_info_instances();
  foreach ($instances as $entity_type => $entities) {
    foreach ($entities as $bundle => $fields) {
      foreach ($fields as $field_name => $instance) {
        $changed = FALSE;
        if (in_array($instance['widget']['type'], array(
          'soundcloud_url',
        ))) {
          if (isset($instance['settings']['soundcloudplayer']['flash_player'])) {
            unset($instance['settings']['soundcloudplayer']['flash_player']);
            $changed = TRUE;
          }
          if (isset($instance['settings']['height'])) {
            unset($instance['settings']['height']);
            $changed = TRUE;
          }
          if (isset($instance['settings']['height_sets'])) {
            unset($instance['settings']['height_sets']);
            $changed = TRUE;
          }
          if (isset($instance['settings']['showcomments'])) {
            unset($instance['settings']['showcomments']);
            $changed = TRUE;
          }
        }
        if ($changed) {
          field_update_instance($instance);
        }
      }
    }
  }
  field_cache_clear();
  drupal_set_message(t('Field instances of type SoundCloud have been updated.'));
}