You are here

function _classified_get_breadcrumb_by_term in Classified Ads 6.3

Same name and namespace in other branches
  1. 7.3 classified.module \_classified_get_breadcrumb_by_term()

Build a Classified Ad breadcrumb trail for an a term.

Parameters

object $term: A fully loaded term for which a trail must be built.

boolean $include_last: When building a breadcrumb trail for a term, it should not be included, as it will be the last component of the BC. However, when building for another type of page, like a node page, it needs to be included, as it is not the last component of the BC.

Return value

array A breadcrumb trail array.

5 calls to _classified_get_breadcrumb_by_term()
_classified_get_breadcrumb_by_node in ./classified.module
Build a breadcrumb trail for an a Classified Ad node
_classified_page_term in ./classified.module
Page callback for classified/<tid>.
_classified_scheduled_page_expire in ./classified.scheduled.inc
Page callback for expirations
_classified_scheduled_page_notify in ./classified.scheduled.inc
Page callback for notifications
_classified_scheduled_page_purge in ./classified.scheduled.inc
Page callback for purges.

File

./classified.module, line 243
A pure D6 classified ads module inspired by the ed_classified module.

Code

function _classified_get_breadcrumb_by_term($term = NULL, $include_last = FALSE) {
  $bc = array();
  if (is_object($term) && $term->vid != _classified_get('vid')) {
    watchdog('classified', 'Building a breadcrumb trail for a term outside the Classified Ad vocabulary', array(), WATCHDOG_WARNING, l($term->name, 'admin/content/taxonomy/edit/term/' . $term->tid));
  }

  // Worst case: array() for tid == 0.
  $parents = taxonomy_get_parents_all(isset($term->tid) ? $term->tid : 0);
  if (!$include_last && !empty($parents)) {

    // Remove current term.
    array_shift($parents);
  }
  foreach ($parents as $term) {
    array_unshift($bc, l($term->name, taxonomy_term_path($term)));
  }
  array_unshift($bc, l(t('Classified Ads'), 'classified'));
  array_unshift($bc, l(t('Home'), '<front>'));
  return $bc;
}