You are here

function entity_translation_preprocess_page in Entity Translation 7

Preprocess variables for 'page.tpl.php'.

File

./entity_translation.module, line 1638

Code

function entity_translation_preprocess_page(&$variables) {
  if (!empty($variables['tabs']['#secondary'])) {
    $language_tabs = array();
    foreach ($variables['tabs']['#secondary'] as $index => $tab) {
      if (!empty($tab['#language_tab'])) {
        $language_tabs[] = $tab;
        unset($variables['tabs']['#secondary'][$index]);
      }
    }
    if (!empty($language_tabs)) {
      if (count($variables['tabs']['#secondary']) <= 1) {
        $variables['tabs']['#secondary'] = $language_tabs;
      }
      else {

        // If secondary tabs are already defined we need to add another level
        // and wrap it so that it will be positioned on its own row.
        $variables['tabs']['#secondary']['#language_tabs'] = $language_tabs;
        $variables['tabs']['#secondary']['#pre_render']['entity_translation'] = 'entity_translation_language_tabs_render';
      }
    }
  }
}