You are here

function media_gallery_update_7007 in Media Gallery 7.2

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

Fix stored display settings for the 'add_media_link' extra field to include 'weight'.

File

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

Code

function media_gallery_update_7007() {

  // _field_extra_fields_pre_render() requires an explicit 'weight' value for
  // all extra field settings stored in the database. Early versions of this
  // module failed to include that.
  $bundle_settings = field_bundle_settings('node', 'media_gallery');
  if (isset($bundle_settings['extra_fields']['display']['add_media_link'])) {
    foreach ($bundle_settings['extra_fields']['display']['add_media_link'] as $view_mode => &$settings) {
      $settings += array(
        'weight' => 1,
      );
    }
  }
  field_bundle_settings('node', 'media_gallery', $bundle_settings);
}