You are here

function _emimage_upgrade_from_image_ncck in Embedded Media Field 6

Same name and namespace in other branches
  1. 6.3 contrib/emimage/emimage.install \_emimage_upgrade_from_image_ncck()
  2. 6.2 contrib/emimage/emimage.install \_emimage_upgrade_from_image_ncck()

Implementation of hook_disable().

1 call to _emimage_upgrade_from_image_ncck()
emimage_install in contrib/emimage/emimage.install
Implementation of hook_install().

File

contrib/emimage/emimage.install, line 38
This is the emimage.module's install, configuration, and removal instructions.

Code

function _emimage_upgrade_from_image_ncck() {
  $ret = array();

  // Change any fields from 'image_ncck' to 'emimage' type.
  db_query("UPDATE {content_node_field} SET type='emimage' WHERE type='image_ncck'");
  db_query("UPDATE {content_node_field_instance} SET widget_type='emimage_textfields' WHERE widget_type='image_ncck_textfields'");

  // Rebuild our content types.
  content_clear_type_cache();

  // Load our existing fields.
  $fields = content_fields();
  drupal_load('module', 'emfield');
  foreach (emfield_system_list('emimage') as $provider) {
    $test = variable_get('emfield_image_ncck_allow_' . $provider->name, NULL) || variable_get('image_ncck_allow_' . $provider->name, NULL);
    if (isset($test)) {
      variable_set('emfield_emimage_allow_' . $provider->name, $test);
      variable_del('emfield_image_ncck_allow_' . $provider->name);
      variable_del('image_ncck_allow_' . $provider->name);
    }
  }

  // </Fancy Hand-Waving>
  return TRUE;
}