You are here

function pm_set_breadcrumb in Drupal PM (Project Management) 7.3

Helper function to set breadcrumb based on which links a user has access to.

18 calls to pm_set_breadcrumb()
pmexpense_form in pmexpense/pmexpense.module
Implements hook_pmexpense_form().
pmexpense_view in pmexpense/pmexpense.module
Implements hook_view().
pmissue_form in pmissue/pmissue.module
Implements hook_form().
pmissue_view in pmissue/pmissue.module
Implements hook_view().
pmnote_form in pmnote/pmnote.module
Implements hook_form().

... See full list

File

./pm.module, line 653
Main module file for the Project Management module.

Code

function pm_set_breadcrumb(array $links, $pm_root = TRUE) {
  $breadcrumb = array();

  // Unless set otherwise, all breadcrumbs start with a link to pm.
  if ($pm_root && drupal_valid_path('pm')) {
    $breadcrumb = array(
      l(t('Project Management'), 'pm'),
    );
  }

  // Now process any other links provided.
  foreach ($links as $link) {
    $text = $link['text'];
    $path = $link['path'];
    $options = isset($link['options']) ? $link['options'] : array();
    if (drupal_valid_path($path)) {
      $breadcrumb[] = l($text, $path, $options);
    }
  }

  // Only set the breadcrumb if one or more links are present.
  if (!empty($breadcrumb)) {
    drupal_set_breadcrumb($breadcrumb);
  }
}