Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /**
- * Implements theme_preprocess_page().
- */
- function ete_preprocess_page(&$vars, $hook) {
- //add mlid class if level > home
- if(!$vars['is_front']) {
- $active_trail = menu_get_active_trail();
- $active_mlid = $active_trail[1]['mlid'];
- $vars['body_classes'] .= ' trail-'.$active_mlid;
- }
- //add title ETE blog to blog_post and blog_landing page
- $ete_blog_title = locale('ETE blog');
- if($vars['node']->type=='blog_post') {
- $vars['title'] = $ete_blog_title;
- }
- //Testing the call
- global $language;
- $lang_name = $language->language;
- $url = explode('/', drupal_get_path_alias($_GET['q']));
- $urlq = explode('/', $_GET['q']);
- //print_r("lang=" . $lang_name);
- print_r("URL[0]=". $url[0]);
- print_r("URL[1]=". $url[1]);
- print_r("URLq[0]".$urlq[0]);
- print_r("URLq[1]".$urlq[1]);
- //This first link is overriden, but we have to define it.
- $breadcrumb[] = l('Home', '<front>');
- //Switch according to the language
- switch ($lang_name) {
- case 'en' :
- //If we are on the first level, and the second level is empty, we 'can set the title of the page and no link
- switch ($url[0]) {
- case 'the-project':
- $breadcrumb[] = l('The Project', 'the-project');
- print_r("We are in the project!");
- break;
- case 'blog-1':
- $breadcrumb[] = l('Blog', 'blog-1');
- break;
- case 'reading-room':
- $breadcrumb[] = l('Reading Room', 'reading-room');
- break;
- case 'centers-and-organizations' :
- $breadcrumb[] = l('Centers and Organizations', 'centers-and-organizations');
- break;
- case 'contact' :
- $breadcrumb[] = l('Contact', 'contact');
- break;
- case 'legal-terms' :
- $breadcrumb[] = l('Legal Terms', 'legal-terms');
- break;
- }
- case 'es' :
- //If we are on the first level, and the second level is empty, we 'can set the title of the page and no link
- switch ($url[0]) {
- case 'el-proyecto':
- $breadcrumb[] = l('El Proyecto', 'el-proyecto');
- break;
- case 'blog':
- $breadcrumb[] = l('Blog', 'blog');
- break;
- case 'banco-de-documentacion':
- $breadcrumb[] = l('Banco de Documentación', 'banco-de-documentacion');
- break;
- case 'centros-y-organizaciones' :
- $breadcrumb[] = l('Centros y Organizaciones', 'centros-y-organizaciones');
- break;
- case 'contacto' :
- $breadcrumb[] = l('Contacto', 'contacto');
- break;
- case 'terminos-legales' :
- $breadcrumb[] = l('Términos Legales', 'terminos-legales');
- break;
- }
- break;
- case 'pt' :
- break;
- }
- // Set Breadcrumbs
- print_r($breadcrumb);
- drupal_set_breadcrumb($breadcrumb);
- }
Add Comment
Please, Sign In to add comment