Determines if a path corresponds to a valid shortcut link.
$path: The path to the link.
TRUE if the shortcut link is valid, FALSE otherwise. Valid links are ones that correspond to actual paths on the site.
function shortcut_valid_link($path) {
// Do not use URL aliases.
$normal_path = drupal_container()
->get('path.alias_manager')
->getSystemPath($path);
if ($path != $normal_path) {
$path = $normal_path;
}
// An empty path is valid too and will be converted to <front>.
return !url_is_external($path) && menu_get_item($path) || empty($path) || $path == '<front>';
}