You are here

function _easy_breadcrumb_obtain_segment_title in Easy Breadcrumb 7.2

Obtain the title of the given segment.

Parameters

string $normal_path: Segment's normal path.

string $valid_path: Flag if the URL of the segment if valid.

string $segment_text: Raw text to be used as fallback to infer the segment's title.

Return value

string segment title.

1 call to _easy_breadcrumb_obtain_segment_title()
_easy_breadcrumb_build_items in ./easy_breadcrumb.module
Helper function to generate breadcrumb items.

File

./easy_breadcrumb.module, line 491
The Easy Breadcrumb module provides a block to be embedded in any page.

Code

function _easy_breadcrumb_obtain_segment_title($normal_path, $valid_path, $segment_text) {

  // If path is valid then try to obtain the title from the menu router
  // (if available).
  if ($valid_path) {
    $router_item = menu_get_item($normal_path);

    // If not using segment text as title then use the menu router title.
    if (!variable_get(EasyBreadcrumbConstants::DB_VAR_SEGMENT_TEXT_AS_TITLE, FALSE)) {
      $title = $router_item['title'];
    }
  }

  // Just infer the title from the segment text.
  if (!isset($title) || $title === '') {
    $title = _easy_breadcrumb_normalize_text($segment_text);
  }
  return $title;
}