Created
July 20, 2016 15:35
-
-
Save anonymous/941e9735d44c95b5c4a2bbabf08f48c0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Implements hook_html_head_alter(). | |
* This will overwrite the default meta character type tag with HTML5 version. | |
*/ | |
function medical_zymphonies_theme_html_head_alter(&$head_elements) { | |
$head_elements['system_meta_content_type']['#attributes'] = array( | |
'charset' => 'utf-8' | |
); | |
} | |
/** | |
* Insert themed breadcrumb page navigation at top of the node content. | |
*/ | |
function medical_zymphonies_theme_breadcrumb($variables) { | |
$breadcrumb = $variables['breadcrumb']; | |
if (!empty($breadcrumb)) { | |
// Use CSS to hide titile .element-invisible. | |
$output = '<h2 class="element-invisible">' . t('You are here') . '</h2>'; | |
// comment below line to hide current page to breadcrumb | |
$breadcrumb[] = drupal_get_title(); | |
$output .= '<nav class="breadcrumb">' . implode(' » ', $breadcrumb) . '</nav>'; | |
return $output; | |
} | |
} | |
/** | |
* Override or insert variables into the page template. | |
*/ | |
function medical_zymphonies_theme_preprocess_page(&$vars) { | |
if (isset($vars['main_menu'])) { | |
$vars['main_menu'] = theme('links__system_main_menu', array( | |
'links' => $vars['main_menu'], | |
'attributes' => array( | |
'class' => array('links', 'main-menu', 'clearfix'), | |
), | |
'heading' => array( | |
'text' => t('Main menu'), | |
'level' => 'h2', | |
'class' => array('element-invisible'), | |
) | |
)); | |
} | |
else { | |
$vars['main_menu'] = FALSE; | |
} | |
if (isset($vars['secondary_menu'])) { | |
$vars['secondary_menu'] = theme('links__system_secondary_menu', array( | |
'links' => $vars['secondary_menu'], | |
'attributes' => array( | |
'class' => array('links', 'secondary-menu', 'clearfix'), | |
), | |
'heading' => array( | |
'text' => t('Secondary menu'), | |
'level' => 'h2', | |
'class' => array('element-invisible'), | |
) | |
)); | |
} | |
else { | |
$vars['secondary_menu'] = FALSE; | |
} | |
} | |
/** | |
* Duplicate of theme_menu_local_tasks() but adds clearfix to tabs. | |
*/ | |
function medical_zymphonies_theme_menu_local_tasks(&$variables) { | |
$output = ''; | |
if (!empty($variables['primary'])) { | |
$variables['primary']['#prefix'] = '<h2 class="element-invisible">' . t('Primary tabs') . '</h2>'; | |
$variables['primary']['#prefix'] .= '<ul class="tabs primary clearfix">'; | |
$variables['primary']['#suffix'] = '</ul>'; | |
$output .= drupal_render($variables['primary']); | |
} | |
if (!empty($variables['secondary'])) { | |
$variables['secondary']['#prefix'] = '<h2 class="element-invisible">' . t('Secondary tabs') . '</h2>'; | |
$variables['secondary']['#prefix'] .= '<ul class="tabs secondary clearfix">'; | |
$variables['secondary']['#suffix'] = '</ul>'; | |
$output .= drupal_render($variables['secondary']); | |
} | |
return $output; | |
} | |
/** | |
* Override or insert variables into the node template. | |
*/ | |
function medical_zymphonies_theme_preprocess_node(&$variables) { | |
$node = $variables['node']; | |
if ($variables['view_mode'] == 'full' && node_is_page($variables['node'])) { | |
$variables['classes_array'][] = 'node-full'; | |
} | |
} | |
function medical_zymphonies_theme_page_alter($page) { | |
// <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"/> | |
$viewport = array( | |
'#type' => 'html_tag', | |
'#tag' => 'meta', | |
'#attributes' => array( | |
'name' => 'viewport', | |
'content' => 'width=device-width' | |
) | |
); | |
drupal_add_html_head($viewport, 'viewport'); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment