You are here

function media_gallery_preprocess_node in Media Gallery 7

Same name and namespace in other branches
  1. 7.2 media_gallery.module \media_gallery_preprocess_node()

Implements MODULE_preprocess_node().

File

./media_gallery.module, line 1195

Code

function media_gallery_preprocess_node(&$variables) {

  // Do not show the title when a node is being displayed in a media gallery
  // block.
  if ($variables['view_mode'] == 'media_gallery_block') {
    $variables['title'] = '';
  }

  // Gallery teasers (for example, the ones that appear on the Galleries page)
  // require special theming of their content. We set that up here instead of as
  // part of hook_node_view_alter() or similar, because we want the node itself
  // to have #theme='node' as normal, and only want to add special theming for
  // the node content, but the content element isn't created until
  // template_preprocess_node().
  if ($variables['node']->type == 'media_gallery' && $variables['view_mode'] == 'teaser') {
    $variables['content']['#theme'] = 'media_gallery_teaser';
    $variables['content']['#node'] = $variables['node'];
    $variables['classes_array'][] = 'mg-gallery';
    $variables['classes_array'][] = 'mg-teaser';
  }
}