You are here

function media_gallery_update_7001 in Media Gallery 7.2

Same name and namespace in other branches
  1. 7 media_gallery.install \media_gallery_update_7001()

Updates all gallery nodes to use new default settings.

File

./media_gallery.install, line 1052
Install file for media_gallery. Includes field and instance definitions.

Code

function media_gallery_update_7001() {
  $result = db_query("SELECT nid FROM {node} WHERE type = 'media_gallery'");
  foreach ($result as $record) {
    $node = node_load($record->nid);
    if ($node->media_gallery_format[LANGUAGE_NONE][0]['value'] == 'lightbox_text') {
      $node->media_gallery_format[LANGUAGE_NONE][0]['value'] = 'lightbox';
      $node->media_gallery_lightbox_extras[LANGUAGE_NONE][0]['value'] = 0;
      node_save($node);
    }
  }
}