-
Notifications
You must be signed in to change notification settings - Fork 0
/
asc_breadcrumbs.module
103 lines (97 loc) · 2.54 KB
/
asc_breadcrumbs.module
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
<?php
/**
* @file
* Module to supply breadcrumbs for ASC Sites.
*/
/**
* @defgroup asc_breadcrumbs
* Simple module to override breadcrumbs for ASC sites..
*
*/
/**
* Implements hook_preprocess_page().
*
* Create breadcrumbs for our content types and set the trail; otherwise, use
* the title as the second trail item.
*
*/
function asc_breadcrumbs_preprocess_page($vars) {
if (!$vars['is_front']) {
$breadcrumb[] = l(t('Home'), NULL);
$sections = array(
'asc_news' => array(
'name' => 'News',
'path' => 'news',
),
'asc_announcement' => array(
'name' => 'Announcements',
'path' => 'announcements',
),
'asc_event' => array(
'name' => 'Events',
'path' => 'events',
),
'asc_exhibition' => array(
'name' => 'Exhibitions',
'path' => 'exhibitions',
),
'asc_design' => array(
'name' => 'Designs',
'path' => 'designs',
),
'asc_people' => array(
'name' => 'People',
'path' => 'directory',
),
'asc_blog' => array(
'name' => 'Blog',
'path' => 'blog',
),
'asc_stories' => array(
'name' => 'Stories',
'path' => 'stories',
),
'asc_workshop_course' => array(
'name' => 'Courses',
'path' => 'courses',
),
'asc_workshop' => array(
'name' => 'Workshops',
'path' => 'upcoming-workshops',
),
'asc_courses' => array(
'name' => 'Courses',
'path' => 'courses',
),
'publications' => array(
'name' => 'Publications',
'path' => 'publications',
),
'product_page' => array(
'name' => 'Store',
'path' => 'store',
),
'product_display' => array(
'name' => 'Store',
'path' => 'store',
),
'dissertation' => array(
'name' => 'Dissertations',
'path' => 'dissertations',
),
);
$type = (isset($vars['node']->type) ? $vars['node']->type : '');
if (isset($type) && array_key_exists($type, $sections)) {
$breadcrumb[] = l($sections[$type]['name'], $sections[$type]['path']);
$noemtitle = preg_replace('/<\/?em>/', '', drupal_get_title());
$breadcrumb[] = l($noemtitle, request_path());
drupal_set_breadcrumb($breadcrumb);
}
else {
$breadcrumb = menu_get_active_breadcrumb();
$noemtitle = preg_replace('/<\/?em>/', '', drupal_get_title());
$breadcrumb[] = l($noemtitle, request_path());
drupal_set_breadcrumb($breadcrumb);
}
}
}