function ds_extras_entity_view_alter

cis7 ds_extras.module ds_extras_entity_view_alter(&$build, $entity_type)
cle7 ds_extras.module ds_extras_entity_view_alter(&$build, $entity_type)
elmsmedia7 ds_extras.module ds_extras_entity_view_alter(&$build, $entity_type)
icor7 ds_extras.module ds_extras_entity_view_alter(&$build, $entity_type)
meedjum_blog7 ds_extras.module ds_extras_entity_view_alter(&$build, $entity_type)
mooc7 ds_extras.module ds_extras_entity_view_alter(&$build, $entity_type)

Implements hook_entity_view_alter().

File

sites/all/modules/ulmus/ds/modules/ds_extras/ds_extras.module, line 583
Display Suite extras main functions.

Code

function ds_extras_entity_view_alter(&$build, $entity_type) {
  static $loaded = array();

  // If views and core doesn't send information along on the entity,
  // Display Suite doesn't have a context to render the layout.
  if (!isset($build['#entity_type']) || !isset($build['#bundle'])) {
    return;
  }

  $bundle = $build['#bundle'];
  $view_mode = $build['#view_mode'];
  if ($overridden_view_mode = ds_extras_get_view_mode()) {
    $view_mode = $overridden_view_mode;
  }
  $layout = ds_get_layout($entity_type, $bundle, $view_mode);

  // Page title options.
  if (variable_get('ds_extras_hide_page_title', FALSE)) {
    $page_title = &drupal_static('ds_page_title');
    if (isset($layout['settings']['hide_page_title']) && $layout['settings']['hide_page_title'] == 1 && ds_extras_is_entity_page_view($build, $entity_type)) {
      $page_title['title'] = '';
    }
    elseif (isset($layout['settings']['hide_page_title']) && $layout['settings']['hide_page_title'] == 2 && !empty($layout['settings']['page_option_title']) && ds_extras_is_entity_page_view($build, $entity_type)) {
      $contexts = array();
      $id = (arg(0) == 'taxonomy') ? arg(2) : arg(1);
      $entity = entity_load($entity_type, array($id));
      ds_create_entity_context($entity_type, $entity[$id], $contexts);
      $title = $layout['settings']['page_option_title'];
      $title = filter_xss_admin(ctools_context_keyword_substitute($title, array(), $contexts));
      $page_title['title'] = $title;
      $page_title['head_title'] = $title;
    }
  }

  // Disable blocks.
  if (isset($layout['settings']['hide_sidebars']) && !isset($loaded[$entity_type][$bundle][$view_mode])) {

    // Store the setting.
    $loaded[$entity_type][$bundle][$view_mode] = TRUE;

    // Disable blocks.
    if (isset($layout['settings']['hide_sidebars']) && $layout['settings']['hide_sidebars']) {
      ctools_set_no_blocks();
    }
  }
}