Guest User

Untitled

a guest
May 27th, 2018
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.83 KB | None | 0 0
  1. <?php
  2. /**
  3. * Implements theme_preprocess_page().
  4. */
  5. function ete_preprocess_page(&$vars, $hook) {
  6. //add mlid class if level > home
  7. if(!$vars['is_front']) {
  8. $active_trail = menu_get_active_trail();
  9. $active_mlid = $active_trail[1]['mlid'];
  10. $vars['body_classes'] .= ' trail-'.$active_mlid;
  11. }
  12. //add title ETE blog to blog_post and blog_landing page
  13. $ete_blog_title = locale('ETE blog');
  14. if($vars['node']->type=='blog_post') {
  15. $vars['title'] = $ete_blog_title;
  16. }
  17. //Testing the call
  18. global $language;
  19. $lang_name = $language->language;
  20. $url = explode('/', drupal_get_path_alias($_GET['q']));
  21. $urlq = explode('/', $_GET['q']);
  22. //print_r("lang=" . $lang_name);
  23. print_r("URL[0]=". $url[0]);
  24. print_r("URL[1]=". $url[1]);
  25. print_r("URLq[0]".$urlq[0]);
  26. print_r("URLq[1]".$urlq[1]);
  27. //This first link is overriden, but we have to define it.
  28. $breadcrumb[] = l('Home', '<front>');
  29. //Switch according to the language
  30. switch ($lang_name) {
  31. case 'en' :
  32. //If we are on the first level, and the second level is empty, we 'can set the title of the page and no link
  33. switch ($url[0]) {
  34. case 'the-project':
  35. $breadcrumb[] = l('The Project', 'the-project');
  36. print_r("We are in the project!");
  37. break;
  38. case 'blog-1':
  39. $breadcrumb[] = l('Blog', 'blog-1');
  40. break;
  41. case 'reading-room':
  42. $breadcrumb[] = l('Reading Room', 'reading-room');
  43. break;
  44. case 'centers-and-organizations' :
  45. $breadcrumb[] = l('Centers and Organizations', 'centers-and-organizations');
  46. break;
  47. case 'contact' :
  48. $breadcrumb[] = l('Contact', 'contact');
  49. break;
  50. case 'legal-terms' :
  51. $breadcrumb[] = l('Legal Terms', 'legal-terms');
  52. break;
  53. }
  54. case 'es' :
  55. //If we are on the first level, and the second level is empty, we 'can set the title of the page and no link
  56. switch ($url[0]) {
  57. case 'el-proyecto':
  58. $breadcrumb[] = l('El Proyecto', 'el-proyecto');
  59. break;
  60. case 'blog':
  61. $breadcrumb[] = l('Blog', 'blog');
  62. break;
  63. case 'banco-de-documentacion':
  64. $breadcrumb[] = l('Banco de Documentación', 'banco-de-documentacion');
  65. break;
  66. case 'centros-y-organizaciones' :
  67. $breadcrumb[] = l('Centros y Organizaciones', 'centros-y-organizaciones');
  68. break;
  69. case 'contacto' :
  70. $breadcrumb[] = l('Contacto', 'contacto');
  71. break;
  72. case 'terminos-legales' :
  73. $breadcrumb[] = l('Términos Legales', 'terminos-legales');
  74. break;
  75. }
  76. break;
  77. case 'pt' :
  78. break;
  79. }
  80. // Set Breadcrumbs
  81. print_r($breadcrumb);
  82. drupal_set_breadcrumb($breadcrumb);
  83. }
Add Comment
Please, Sign In to add comment