You are here

function node_gallery_apply_cck_settings_to_image_types in Node Gallery 6.3

Given a settings associative array uses content_crud to apply settings to the widget for all image types

Parameters

$default_settings: An associative array of settings to apply

File

./node_gallery.inc, line 1020
Shared functions for node_gallery

Code

function node_gallery_apply_cck_settings_to_image_types($settings) {
  module_load_include('inc', 'content', 'includes/content.crud');
  $image_types = (array) node_gallery_get_types('image');
  foreach ($image_types as $image_type) {
    $rel = node_gallery_get_relationship(NULL, $image_type);
    $param = array(
      'type_name' => $image_type,
      'field_name' => $rel['imagefield_name'],
    );
    $image_field = array_pop(content_field_instance_read($param));
    $image_field = array_merge($image_field, $settings);
    content_field_instance_update($image_field, FALSE);
  }

  // we clear the caches here once instead of with content_field_instance_update()
  // in case there are several fields.
  content_clear_type_cache(TRUE);
  menu_rebuild();
}