Commit ada0895c authored by Lily Yan's avatar Lily Yan
Browse files

ISTWCMS-3142 Add breadcrumbs on every calendar, day and archive pages

parent 982f6c0f
......@@ -931,17 +931,23 @@ function uw_ct_event_page_build() {
case 'events':
drupal_add_js(drupal_get_path('module', 'uw_ct_event') . '/js/uw_ct_event.js');
if (isset($path[1]) && $path[1] == 'archive' && isset($path[2])) {
$breadcrumb = drupal_get_breadcrumb();
if (isset($breadcrumb[1])) {
unset($breadcrumb[1]);
}
drupal_set_breadcrumb($breadcrumb);
}
if (isset($path[1]) && ($path[1] == 'calendar' || $path[1] == 'day')) {
if (isset($path[1])) {
$breadcrumb = drupal_get_breadcrumb();
if (isset($breadcrumb[1])) {
unset($breadcrumb[1]);
// Set 'Events' breadcrumb for events/calendar or events/day
if ($path[1] == 'calendar' || $path[1] == 'day') {
$breadcrumb[1] = l('Events', 'events');
}
elseif ($path[1] == 'archive' && isset($path[2])) {
// Set 'Events' breadcrumb for events/archive/[year].
$breadcrumb[1] = l('Events', 'events');
// Set 'Events>[Year]' breadcrumb for events/archive/[year-month]
// if $path[2] matches yyyy-mm or yyyy-m.
if (preg_match('/^(\d{4})-(\d{1,2})$/', $path[2], $matches)) {
$breadcrumb[2] = l($matches[1], 'events/archive/' . $matches[1]);
}
}
}
drupal_set_breadcrumb($breadcrumb);
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment