You are here

function oembedfield_update_7000 in oEmbed 7.0

Same name and namespace in other branches
  1. 7 modules/oembedfield/oembedfield.install \oembedfield_update_7000()

Transition field formatters to oEmbed core module.

File

deprecated/oembedfield.install, line 16

Code

function oembedfield_update_7000() {
  foreach (field_info_field_map() as $field_name => $info) {
    if ($info['type'] == 'link_field') {
      foreach ($info['bundles'] as $entity_type => $bundles) {
        foreach ($bundles as $bundle_name) {
          $instance = field_read_instance($entity_type, $field_name, $bundle_name);
          foreach ($instance['display'] as &$display) {
            if ($display['module'] == 'oembedfield') {
              $changed = TRUE;
              $display['module'] = 'oembedcore';
            }
          }
          if ($changed) {
            field_update_instance($instance);
          }
          $changed = FALSE;
        }
      }
    }
  }
}