Customizing Breadcrumb in Drupal
Drupal has auto generated breadcrumb for every
page. Customizing the breadcrumb is need at some point for our purpose
we can get the drupal breadcrumb for a page using
the function
drupal_get_breadcrumb()
and we can add layers to that or reset it
Eg A:
if the default breadcrumb is
user >> edit
and we want to set it to
user >> edit >> options
then code will be
$breadcrumbs = drupal_get_breadcrumb(); /// to get the existing breadcrumb
$breadcrumbs[] = l(t(’options’), ‘path here); /// appending new path to old
drupal_set_breadcrumb($breadcrumbs); //// assigning the new breadcrumb
Eg A:
if the default breadcrumb is
user >> edit
and we want to set it to
user >> users blog
then code will be
$breadcrumbs[] = l(t(’user’), ‘path here);
$breadcrumbs[] = l(t(’users blog’), ‘path here);
drupal_set_breadcrumb($breadcrumbs);
