Skip to content

Instantly share code, notes, and snippets.

@sadrul
Last active August 29, 2015 14:08
Show Gist options
  • Save sadrul/ea97e2a468ec0afa2614 to your computer and use it in GitHub Desktop.
Save sadrul/ea97e2a468ec0afa2614 to your computer and use it in GitHub Desktop.
custom breadcrumb
<?php
function custom_breadcrumb() {
= node_load(arg(1));
= ['breadcrumb'];
if (!empty()) {
if (!drupal_is_front_page() && !empty()) {
= filter_xss(menu_get_active_title(), array());
if (->type == 'family') {
[] = l(t('Family'), 'pregnant/choose-adoption-family');
} elseif (->type == 'story') {
[] = l(t('Story'), 'stories-more');
}
[] = ;
}
if (count() == 1) {
= array();
}
switch (->type) {
case 'family':
case 'story':
break;
default:
= menu_get_active_trail();
if (count() < 3)
return '';
}
array_shift();
return strip_tags(theme('item_list', array('items' => , 'attributes' => array('class' => array('breadcrumb')))), '<ul><li><a>');
}
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment