You are here

function _easy_breadcrumb_validate_path_alias in Easy Breadcrumb 6

Same name and namespace in other branches
  1. 7 includes/easy_breadcrumb.blocks.inc \_easy_breadcrumb_validate_path_alias()

Check if the given path is valid (exists).

Parameters

string $path_alias: the path to be checked.

Return value

boolean TRUE if the path is valid, false otherwise.

1 call to _easy_breadcrumb_validate_path_alias()
_easy_breadcrumb_block in includes/easy_breadcrumb.blocks.inc
Obtains the 'easy_breadcrumb' block.

File

includes/easy_breadcrumb.blocks.inc, line 195
Module's blocks.

Code

function _easy_breadcrumb_validate_path_alias($path_alias) {

  // Check if the path is stored in the actual menu router.
  $valid = menu_valid_path(array(
    'link_path' => drupal_get_normal_path($path_alias),
  ));

  // If don't exists in the actual menu router, then check if it's an url_alias
  // (was generated by the pathauto module).
  if (empty($valid)) {
    $drupal_path = drupal_lookup_path('source', $path_alias);
    $valid = !empty($drupal_path);
  }
  return $valid;
}