summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMaurits Lawende2013-02-04 21:21:01 (GMT)
committer Maurits Lawende2013-02-04 21:21:01 (GMT)
commit0715082bd2566bba5098bb1a1e2dbafdbef907aa (patch)
tree701b46935c21afb3b4986aadacaed026d6b8d6c6
parenta4f3efbd11c6b41cabbea68edd757fd50be19615 (diff)
Add flags option to hansel_get_breadcrumbs to provide a way for switches and actions to act different
-rw-r--r--hansel.module17
1 files changed, 11 insertions, 6 deletions
diff --git a/hansel.module b/hansel.module
index ebbd942..1b3ed0d 100644
--- a/hansel.module
+++ b/hansel.module
@@ -454,13 +454,18 @@ function hansel_get_config() {
* @param bool $keep_last_item
* Force this function to keep the last item, even when the settings are set
* to hide it. This is used for the alias token.
+ * @param array $flags
+ * Breadcrumb actions and switches can act differently upon the given flags.
* @return mixed
* Array with breadcrumbs or FALSE (means: leave with restore option).
*/
-function hansel_get_breadcrumbs($test = FALSE, $plaintext = FALSE, $keep_last_item = FALSE) {
+function hansel_get_breadcrumbs($test = FALSE, $plaintext = FALSE, $keep_last_item = FALSE, $flags = array()) {
+ global $_hansel_flags;
+ $_hansel_flags = $flags;
+
$config = hansel_get_config();
extract($config);
-
+
if (!$start_rid) {
!$test or _hansel_test_message(t('No rule found with name "start" on the top level'));
return FALSE;
@@ -771,11 +776,11 @@ function hansel_cache_set($cid, $data) {
*/
function hansel_tokens($type, $tokens, $data = array(), $options = array()) {
global $_hansel_test_path;
-
+
if (!in_array($type, array('node', 'taxonomy_term', 'user'))) {
return array();
}
-
+
switch ($type) {
case 'node':
$object = $data['node'];
@@ -795,8 +800,8 @@ function hansel_tokens($type, $tokens, $data = array(), $options = array()) {
default:
return array();
}
-
- $path = hansel_get_breadcrumbs(FALSE, TRUE, TRUE);
+
+ $path = hansel_get_breadcrumbs(FALSE, TRUE, TRUE, array('alias'));
if (is_array($path)) {
$path = $path['breadcrumb'];
}