Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /**
- * @file
- * Provide custom breadcrumbs for node-type pages and base functionality
- * for submodules to add custom breadcrumbs for other types of pages.
- */
- /**
- * Implements hook_init().
- */
- function cve_breadcrumbs_init() {
- global $language;
- $lang_name = $language->language;
- $url = explode('/', drupal_lookup_path('alias', $_GET['q']));
- $urlq = explode('/', $_GET['q']);
- $breadcrumb = array();
- //print_r("URL=". $url);
- //print_r("q=". $_GET['q']);
- //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');
- 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;
- }
- //If there is no alias (it is a view), we have to work directly with the arguments from q
- if ($url[0]=='') {
- switch ($urlq[0]) {
- case 'eventos':
- $breadcrumb[] = l('Events', 'eventos');
- break;
- case 'centros-y-organizaciones' :
- $breadcrumb[] = l('Centers and Organizations', 'centros-y-organizaciones');
- break;
- case 'search' :
- $breadcrumb[] = l('Search', 'search');
- break;
- }
- }
- 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;
- }
- //If there is no alias (it is a view), we have to work directly with the arguments from q
- if ($url[0]=='') {
- switch ($urlq[0]) {
- case 'eventos':
- $breadcrumb[] = l('Eventos', 'eventos');
- break;
- case 'centros-y-organizaciones' :
- $breadcrumb[] = l('Centros y Organizaciones', 'centros-y-organizaciones');
- break;
- case 'search' :
- $breadcrumb[] = l('Búsqueda', 'search');
- break;
- }
- }
- break;
- case 'pt' :
- break;
- }
- // Set Breadcrumbs
- drupal_set_breadcrumb($breadcrumb);
- }
Add Comment
Please, Sign In to add comment