summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMaurits Lawende2012-12-06 15:43:32 (GMT)
committer Maurits Lawende2012-12-06 15:43:32 (GMT)
commit95def435e9cac01cc02c14d27a4618e1527682dd (patch)
tree77af7a88f4c281571a336b347a438428da840aca
parentf2ee86c214e7cdc8c4b6fe2f47dd18dd2dd719ab (diff)
Allow links to paths starting with a slash. This can be used to link to paths outside the basepath.
-rw-r--r--hansel.module6
1 files changed, 6 insertions, 0 deletions
diff --git a/hansel.module b/hansel.module
index d67630a..ebbd942 100644
--- a/hansel.module
+++ b/hansel.module
@@ -589,6 +589,12 @@ function hansel_get_breadcrumbs($test = FALSE, $plaintext = FALSE, $keep_last_it
$breadcrumbs[$i] = ($last_item_link || $i != $last_item_number) ? l($breadcrumbs[$i]['title'], '') : check_plain($breadcrumbs[$i]['title']);
break;
default:
+ if ($breadcrumbs[$i]['href'] && $breadcrumbs[$i]['href']{0} == '/') {
+ // Prefix paths starting with a slash with the full URI.
+ if (preg_match('/^(https?...[^\\/]+)/', url('', array('absolute' => TRUE)), $match)) {
+ $breadcrumbs[$i]['href'] = $match[1] . $breadcrumbs[$i]['href'];
+ }
+ }
$breadcrumbs[$i] = ($last_item_link || $i != $last_item_number) ? l($breadcrumbs[$i]['title'], $breadcrumbs[$i]['href']) : check_plain($breadcrumbs[$i]['title']);
}
}