You are here

function node_gallery_api_setup_display_modes in Node Gallery 7

Sets up the admin view mode for Management pages.

2 calls to node_gallery_api_setup_display_modes()
node_gallery_api_install in ./node_gallery_api.install
Implements hook_install().
node_gallery_api_update_7000 in ./node_gallery_api.install
Setup admin thumbnail view modes.

File

./node_gallery_api.install, line 204
Install, update and uninstall functions for the node_gallery_api module.

Code

function node_gallery_api_setup_display_modes() {
  $bundle_settings = field_bundle_settings('file', 'image');
  $bundle_settings['view_modes']['node_gallery_api_admin_thumbnail']['custom_settings'] = TRUE;
  $bundle_settings['view_modes']['node_gallery_api_admin_thumbnail']['file_image']['image_style'] = 'node_gallery_api_admin_thumbnail';
  field_bundle_settings('file', 'image', $bundle_settings);
  $file_displays = file_displays_load('image', 'node_gallery_api_admin_thumbnail');
  if (empty($file_displays['image__node_gallery_api_admin_thumbnail__file_image'])) {
    $file_displays['image__node_gallery_api_admin_thumbnail__file_image'] = file_display_new('image', 'node_gallery_api_admin_thumbnail', 'file_image');
  }
  $file_displays['image__node_gallery_api_admin_thumbnail__file_image']->status = 1;
  $file_displays['image__node_gallery_api_admin_thumbnail__file_image']->settings['image_style'] = 'node_gallery_api_admin_thumbnail';
  file_display_save($file_displays['image__node_gallery_api_admin_thumbnail__file_image']);
}