You are here

function recipe_build_breadcrumbs in Recipe 5

Builds a breadcrumb list.

Parameters

breadcrumb a reference to the breadcrumb array. New items will be appending to this array.:

@return returns a term object if the last item in the url is a term, otherwise returns NULL.

1 call to recipe_build_breadcrumbs()
recipe_page in ./recipe.module
Menu Callback - created output for the main recipe page.

File

./recipe.module, line 1066
recipe.module - share recipes for drupal 5.x

Code

function recipe_build_breadcrumbs(&$breadcrumb) {
  if (arg(1) != NULL) {
    $i = 1;
    $url = 'recipe';
    $breadcrumb[] = l(ucwords(t('Recipes')), $url);
    while (arg($i) != NULL) {
      $last_term = urldecode(arg($i));
      $url = $url . '/' . urlencode($last_term);
      $breadcrumb[] = l(ucwords($last_term), $url);
      $i++;
    }
    $term = current(module_invoke('taxonomy', 'get_term_by_name', $last_term));
    return $term;
  }
  return NULL;
}