Hi, if you configure a custom breadcrumb title using "title|attribute title" and both titles are empty, the breadcrumb item is generated empty and the breadcrumb will be something like:

breadcrumb before >  >  breadcrumb after

The fix is easy. Function _custom_breadcrumbs_get_trail_items() needs to check if the $title is "|". Just add && ($title !="|") to the if:

Correct function:


function _custom_breadcrumbs_get_trail_items($breadcrumb, $titles, $paths) {
  $trail_items = array();

  for ($i = 0; $i < count($titles); $i++) {
    $title = trim($titles[$i]);

    if (($title != '') && ($title != '<none>') && ($title !="|")) {
      // Create a breadcrumb only if there is a title.
      // Include optional html attributes.
      $options = _custom_breadcrumbs_identifiers_option($i + 1, $breadcrumb->bid);
      $crumb_items = _custom_breadcrumbs_create_crumb_items($title, trim($paths[$i]), $options);
      $trail_items = array_merge($trail_items, $crumb_items);
    }
  }
  return $trail_items;
}

Thanks for the attention.

CommentFileSizeAuthor
#2 emptycrumbs-fix.patch642 bytesfinex

Comments

finex’s picture

I've created a small patch with the fix described above.

finex’s picture

Issue summary: View changes
Status: Active » Needs review
StatusFileSize
new642 bytes

I've created a small patch with the fix described above.

lamp5’s picture

Status: Needs review » Closed (outdated)