You are here

README.txt in Hansel breadcrumbs 7

Same filename and directory in other branches
  1. 8 README.txt
PREFACE
-------
Hansel (named after Hansel and Gretel) provides custom breadcrumbs which are
build by user defined rules. These rules are independent from the menu system.
Rules can have logic switches and can add links to the breadcrumbs.

This module is designed for site builders, not for editors. Configuring Hansel
is more difficult than just a few clicks and requires a good understanding of
the rules (see chapter 2: Configuration).

QUICKSTART
----------
For advanced users who dislike reading, you may skip to chapter 3 to take a look
at the example configurations.

CONTENTS
--------
1. Installation
2. Configuration
2.1. Breadcrumb actions
2.1.1. Add domain
2.1.2. Add single link
2.1.3. Add link to node
2.1.4. Add link to nodetype
2.1.5. Add link to user
2.1.6. Add link to current page
2.1.7. Add term path
2.1.8. Add forum path
2.1.9. Add og path (organic group context)
2.1.10. Add parents
2.2. Logical actions
2.2.1. Goto rule
2.2.2. Leave
2.2.3. Switch
2.2.3.1. Subdomain
2.2.3.2. Domain id
2.2.3.3. Url argument
2.2.3.4. Node id
2.2.3.5. Node type
2.2.3.6. Node age
2.2.3.7. Path alias
2.2.3.8. PHP
2.2.3.9. Vocabulary name
2.2.3.10. Request uri
3. Example configurations
3.1. Basic configuration
3.2. Blogs and news
3.3. Montly archive
3.4. Multidomain setup
4. Settings
5. Testing your configuration
6. Exporting / importing
7. Extending hansel
7.1. Writing actions
7.2. Writing switches
8. Helper function for theming

1. Installation
--------------------------------------------------------------------------------
Copy Hansel into your modules directory (i.e. sites/all/modules) and enable
Hansel (on admin/build/modules). You may also want to enable the extra modules:

* Hansel Domain
  Provides integration with the domain module.
* Hansel Export
  Allows you to export and import the whole Hansel configuration.
  Not required for features integration.
* Hansel Forum
  Provides integration with the forum module.
* Hansel OG
  Provides integration with the Organic Groups module.
* Hansel Taxonomy
  Provides integration with the taxonomy module.

Add the "administer hansel" permission to the roles that may access the Hansel
configuration page. No permission is required to view the breadcrumbs. You can
skip this step if only the admin user may access the configuration page.

2. Configuration
--------------------------------------------------------------------------------
After installation, the configuration page will be available at
admin/build/hansel. On this page you'll see a form to add a rule. It is
important to know that Hansel configurations only contains rules. A rule has
four properties:

* Name
  This name is used for identification and used by switches (explained later).
* Parent
  The parent item in the hierarchy. Rules can be organized in a hierarchical
  structure.
* Action with breadcrumbs:
  This specifies what links need to be added the the breadcrumbs when this rule
  is executed. You may only specify one action per rule (some actions may add
  multiple links, however).
* Logical action:
  Defines what needs to be done after executing this rule.

The hierarchical structure is used by switches, but has no affect on other
logical actions, and thus may be used to organize the rules manually.

Generating the breadcrumbs always starts with the rule named "start" on the
topmost hierarchical level (known as root). The process can end in three ways:

* With the "leave" action (see 2.2.2)
* With a switch without matching rule (see 2.2.3)
* On recursion caused by improper configured goto rules (see 2.2.1)

After the process has ended, the breadcrumbs will be replaced by the links which
were created by the breadcrumb actions (see 2.1). In some cases, however, the
original breadcrumbs may be restored (see 2.2.2).

Existing rules are shown on the configuration page (admin/build/hansel) in the
hierarchical structure, ordered alphabetically (except the start rule, which is
displayed on top). All rules have an edit and a delete button in the grey bar
containing the rule name.

2.1. Breadcrumb actions
-----------------------
Breadcrumb actions can add links to the breadcrumbs. A single action may add
multiple links, but may also add no links at all.

When adding a rule, you can select the action in the dropdown box with the title
"Action with breadcrumbs". Some actions have configuration options, those are
shown after clicking the "next" button.

In the overview, the breadcrumb action is displayed right below the rule name.

2.1.1. Add domain
-----------------
This action is only available when the hansel_domain module is enabled. It adds
the current domain name pointing to the domain path.

For more information about what domains are in this context, read the readme
file of the domain module, or visit http://drupal.org/project/domain

2.1.2. Add single link
----------------------
Adds a single - static - link to the breadcrumbs. This action has three
configuration options:

* Link title
  The visible text of the link.
* Translate title
  Make the link title available for translation.
* Link path
  Destination of the link. Do not use leading or trailing slashes. Use "<front>"
  to link to the frontpage or "<none>" to output the crumb as plaintext.

You may use "[arg-N]", which will be replaced by the url argument. "N" must be
replaced by the argument number, where 1 is the first argument. Tokens provided
by the token module (http://drupal.org/project/token) are also available.

2.1.3. Add link to node
-----------------------
When on node pages (thus having "node/%" as path), this will add a link to that
node. The node title is used as link text.

2.1.4. Add link to nodetype
-----------------------
When on node pages (thus having "node/%" as path) or on node add pages
("node/add/%"), this will add a link with the nodetype as title, linking to a
configurable path (defaults to "node/add/[type]"). There are 2 tokens available,
[type], which will be replaced by the machine name of the nodetype with hyphens
("news-feed") and [type-raw], which will be replaced by the original machine
name ("news_feed").

2.1.5. Add link to user
-----------------------
When on user pages (thus having user/% as path), a link to the user profile of
that user is added to the breadcrumbs.

When on node pages (thus having node/% as path), a link to the node author's
user profile is added.

You can configure the text which is used for links to the profile of the current
user. You may enter something like "Your account". This field is optional, the
username of the current user will be used if empty.

A checkbox is available to use the realname provided by the realname module
instead of the username. This option is only visible when the "realname" module
is enabled.

2.1.6. Add link to current page
-------------------------------
This will add a link to the current page, with the page title used as link text.
No link is added if the page title is empty.

2.1.7. Add term path
--------------------
This action is only available when the hansel_taxonomy module is enabled. When
on node pages (thus having node/% as path), this will add the taxonomy term path
for that node to the breadcrumbs. You may force this action to only take terms
from a specified vocabulairy. By default, all vocabulairies are used.

2.1.8. Add forum path
---------------------
Adds the forum path. This works for topic listings ("forum/%") and forum nodes.
The containers are not added to the path by default. There is a configuration
option to change this behavior.

2.1.9. Add og path (organic group context)
------------------------------------------
This actions adds a link to the group node, where the current node belongs to.
The Hansel OG module must be installed in order to have this action available.

2.1.10. Add parents
-------------------
Adds the parent pages to the breadcrumbs. Hansel will use the menu-structure to
get the parents. Other modules may extend this to use other relations as well.

2.2. Logical actions
--------------------
Each rule has a logical action, which is "goto rule", "leave" or "switch". This
action defines what is going to happen after this rule is executed. All actions
have a configuration option, which is displayed after clicking the "next" button
when addding or editing a rule.

2.2.1. Goto rule
----------------
After this rule is executed, we will execute another rule. That rule is
specified in the configuration. The destination may be anywhere in the
hierarchical structure.

2.2.2. Leave
------------
End the breadcrumb generation process as described in the introduction of this
chapter.

You may optionally check the "Restore original breadcrumbs" box. If checked,
the original breadcrumbs (generated by Drupal core) will be used instead of the
breadcrumbs generated by Hansel. This is usefull for sections where you do not
want to override the breadcrumbs (like the admin section, see 3.1).

2.2.3. Switch
-------------
The switch action is like the goto action, but can go to different destinations,
depending on the chosen "switch action".

A switch action is, for example, "node type". This action has a value, which
is the node type for the currently displayed node, for example "story". This
value is compared with the rule names of the child rules of the switch rule.
For example we have four rules configured:

Name: start
Action: switch on node type
  Name: page (child rule of "start")
  Name: story
  Name: <default>

The rule "start" has "switch" as logical action with "node type" as switch type.
On a node page with nodetype "story", the rule "story" is the next rule that
will be executed. On page nodes, the rule "page" is executed. If there is no
corresponding rule to the node type, or if we aren't at a node page at all, the
rule with name "<default>" is executed. The default rule is recognised by the
name, and thus always must be named "<default>". If no matching rule is found
and the default rule is missing, the breadcrumb generation process will end as
described in the introduction of this chapter.

Switches may implement the special empty-rule (rule with the name "<empty>").
This rule is used when the value is empty. This function is only available for
the "url argument" switch.

Switches may have its own configuration options. You don't see them when adding
a rule, but you can find them by clicking on the switch type name on the
configuration page (admin/build/hansel).

2.2.3.1. Subdomain
------------------
This action is only available when the hansel_domain module is enabled. It uses
the subdomain name for the current domain as value to switch on. The subdomain
is likely something is "something.example.com". This is the value of the
"Domain" field under the "Create domain record" tab (on
admin/build/domain/create).

2.2.3.2. Domain id
------------------
This action is like the "subdomain" action, but uses the domain id instead of
subdomain. The domain id is found on the domain list (admin/build/domain). The
advantage of using the domain id instead of the subdomain is that you may rename
the domain without having to change the Hansel rules. However, using the
subdomain provides more readability to the Hansel configuration.

2.2.3.3. Url argument
---------------------
This switch type compares the rule names with a part of the URL path (called
arguments). By default, the first argument is used, but this can be changed on
the switch configuration page. You can get there by clicking on "url argument"
on the main page (admin/build/hansel). There are three options available:

* The url argument number (1 is the first argument).
* Case sensitive matching (disabled by default).
* Match rules by regular expressions (disabled by default).

The first argument can be something like "node" or "admin". URL arguments never
includes slashes.

There is a special "<front>" rule available for this switch. Rules with this
name matches the frontpage. Its working is independent of the url argument
number configured for this switch.

2.2.3.4. Node id
----------------
Switches on the node id of the current displayed node. This only has a value
on paths starting with "node/%".

2.2.3.5. Node type
------------------
Switches on the node type of the current displayed node, like "story" or "page".
This only has a value on paths starting with "node/%".

2.2.3.6. Node age
-----------------
Switches on the age of a node based on node creation time. Subrules can be named
as ranges ("0-1") or with an operator ("< 2"). The unit definition can be
changed in the rule configuration form. When set to 1 day, "0-1" means between
0 and 1 days old. This includes an age of 0 seconds, but not an age of exactly
one day (86400 seconds). The following operators are available: "<", ">", "<="
and ">=". Numbers may contain floating points, where only a dot is allowed as
decimal separator.

2.2.3.7. Path alias
-------------------
Switches on the alias for the current path. By default, child rules matches when
the alias starts with the rule name. You can change this behaviour in the switch
configuration page, where you can choose between 4 modes:

* starts with (rule "content" matches on path "content/first-story")
* ends with (rule "story" matches on path "content/first-story")
* contains (rule "first" matches on path "content/first-story")
* matches regular expression (rule "[a-z]{5}" matches on path
  content/first-story).

Matching is case insensitive by default. You can turn on case sensitive matching
on the switch configuration page.

2.2.3.8. PHP
------------
Switch on the result of custom PHP code. The code must be entered between
<?php and ?> and must return the value to switch on.

In order to be able to configure switches from this type, you need the
"use PHP for hansel configuration" permission.

2.2.3.9. Vocabulary name
------------------------
Switch on the name of the vocabulary. This works on the term pages
(taxonomy/term/%). Matching is always case insensitive.

2.2.3.10. Request uri
---------------------
Switch on the request uri (like "/user"). By default, child rules matches when
the uri starts with the rule name. You can change this behaviour in the switch
configuration page, where you can choose between 4 modes:

* starts with (rule "content" matches on path "content/first-story")
* ends with (rule "story" matches on path "content/first-story")
* contains (rule "first" matches on path "content/first-story")
* matches regular expression (rule "[a-z]{5}" matches on path
  content/first-story).

Matching is case insensitive by default. You can turn on case sensitive matching
on the switch configuration page.

3. Example configurations
--------------------------------------------------------------------------------
This section contains some example configuration. This shows how Hansel is
intended to be used and what the most efficient way is to take control of your
breadcrumbs.

3.1. Basic configuration
------------------------
Name: start (process always start with the rule named "start", see chapter 2).
Breadcrumb action: add link "Home" (use "<front>" as path)
Logic action: switch on url argument 1

  Name: admin
  Breadcrumb action: none
  Logic action: leave (restore original breadcrumbs)

  Name: node
  Breadcrumb action: none
  Logic action: switch on node type

    Name: <default>
    Breadcrumb action: add link to node
    Logic action: leave

  Name: user
  Breadcrumb action: add link to user
  Logic action: leave

This leaves the breadcrumbs for the admin section untouched. Other possibilities
for the first url argument are "node" and "user". For user pages, this will
generate the breadcrumb "Home > Username" or "Home > Your Account" if you filled
in "Your Account" in the breadcrumb action configuration (see 2.1.4). On node
pages this will always have the breadcrumb "Home > Node title". For the reason
why whe didn't set the "add link to node" action on the rule "node", take at
look at the blog example (see 3.1).

3.2. Blogs and news
-------------------
Name: start (process always start with the rule named "start", see chapter 2).
Breadcrumb action: add link "Home" (use "<front>" as path)
Logic action: switch on url argument 1

  Name: admin
  Breadcrumb action: none
  Logic action: leave (restore original breadcrumbs)

  Name: blogs
  Breadcrumb action: add single link (with the text "Blogs")
  Logic action: goto rule "add blog link"

    Name: add blog link
    Breadcrumb action: add link to user
    Logic actions: goto rule "<default>"

  Name: news
  Breadcrumb action: add single link (with the text "News")
  Logic action: goto rule "<default>"

  Name: node
  Breadcrumb action: none
  Logic action: switch on node type

    Name: blog
    Breadcrumb action: add single link (with the text "Blogs")
    Logic action: goto rule "blogs"

    Name: news
    Breadcrumb action: none
    Logic action: goto rule "news" (under "start", not this rule!)

    Name: <default>
    Breadcrumb action: add link to node
    Logic action: leave

  Name: user
  Breadcrumb action: add link to user
  Logic action: leave

Compared to the basic configuration, we have added 2 rules containing node
types, which are "blog" and "news". The "news" rule goes to the rule "news"
under "start", which is a rule we use for the whole news section. That rule adds
the link "News" to the breadcrumbs, linking to "news", which is our news
overview page. After adding that link, we would also like to add a link to the
node. However, we cannot add multiple breadcrumb actions to one rule. The
easiest way to do this is to set the logic action to go to the rule "<default>",
which will add the link to the node, resulting in breadcrumbs like
"Home > News > My news item". The news overview page also ends at the default
rule. However, that rule does not add any links since the overview page is not
a node page. Thus the news overview will have the breadcrumbs "Home > News".

For the blogs, we want breadcrumbs like "Home > Blogs > Author's name > Title".
We need an extra rule to add the author's name in the crumbs. You can see this
in the example. The "blogs" rule adds the link to to "Blogs", then the rule
"add blog link" adds the author's username and at last the "<default>" rule
adds the link to the actual blogpost.

3.3. Montly archive
-------------------
The views module (http://drupal.org/project/views) provides a default view
"archive". This page provides a list of nodes per month. The path of this view
is "archive", clicking on a month leads to a page on "archive/201004" (for April
2010). The following example configuration provides the breadcrumbs
"Montly archive > April 2010".

Name: start (process always start with the rule named "start", see chapter 2).
Breadcrumb action: add link "Home" (use "<front>" as path)
Logic action: switch on url argument 1

  Name: archive
  Breadcrumb action: add link "Montly archive" (use "archive" as path)
  Logic action: switch on url argument 2 with regular expressions

    Name: [0-9]{6}
    Breadcrumb action: add link to current page
    Logic action: leave

Note that you have to change the default settings for the url argument switch
(see 2.2.3.3. Url argument).

3.4. Multidomain setup
----------------------
There are several ways of how you can configure Hansel when using domains. When
you want to have "Home" as the first element for the main domain, and the domain
name for other domains, without configuring the breadcrumbs per domain, we
suggest the following configuration:

Name: start
Breadcrumb action: none
Logic action: switch on domain id

  Name: 0
  Breadcrumb action: add link "Home" (use "<front>" as path)
  Logic action: goto rule "all domains"

  Name: <default>
  Breadcrumb action: add link to domain
  Logic action: goto rule "all domains"

Name: all domains
Breadcrumb action: none
Logic action: switch on url argument 1

  Name: admin
  Breadcrumb action: none
  Logic action: leave (restore original breadcrumbs)

  Name: node
  Breadcrumb action: none
  Logic action: switch on node type

    Name: <default>
    Breadcrumb action: add link to node
    Logic action: leave

  Name: user
  Breadcrumb action: add link to user
  Logic action: leave

4. Settings
--------------------------------------------------------------------------------
A settings page is available on admin/build/hansel/settings. Available options
are:

Render last item as a link
  Determines if the last item of the breadcrumb is a link (checked by default).
Hide last item
  Remove the last item of the breadcrumb.
Maximum length for individual items
  Maximum length in characters. Use 0 to disable trimming.
Trim on word boundary
  Try to trim on whole words. Titles are still trimmed within words if we would
  lose more than 66% of the characters by this action.
Ellipsis
  Text to add after trimmed texts. You may leave this empty.
Maximum number of items
  Maximum number of breadcrumb items. Items will be removed from the middle.
  Use 0 to disable.
Removed items replacement
  Removed breadcrumb items will be replaced by this text. Leave empty to
  disable.
Remove first item from Hansel path token
  The [hansel-path] token should not contain a "Home" item. Check this box if
  the first item of the breadcrumbs is something which should not show in your
  path aliases.
Cache
  Only parts which require interaction with the database are cached. Enabling
  this cache is only recommended when you use an efficient caching system (such
  as memcache). Note that Hansel uses cache only per action / switch. The output
  of the add term path action is cached per node, for example.
Set active menu item
  Set the active menu item based on the breadcrumbs. For example: if your
  breadcrumbs are News > Archive > 2008, it will activate the same menu item.
  If "2008" is not a menu item, it will activate "Archive". If that's not a menu
  item either it will only active "News" if present as a root element.
Skip first crumb
  Ignore the first item of the breadcrumbs when looking for a corresponding menu
  item. Check this box if the first item of the breadcrumbs is something like
  "Home" or "Start".
Set active menu name for current path
  The "Restore original breadcrumbs" option for the "Leave" action will only
  work for the default menu if this box is not checked. But checking this box
  can sometimes result in side-effects.

5. Testing your configuration
--------------------------------------------------------------------------------
Click on the tab "test", this will lead you to admin/build/hansel/test. On this
page you can fill in a path from which you do want to know what the breadcrumbs
for that page will look like.

Hansel tells you how the breadcrumbs are generated. This trace may look like:

    * Executing rule start
    * Executing crumb action add single link
    * Added 1 crumb(s)
    * switch on url argument
    * No match on rule admin
    * Match on rule node
    * Executing rule node
    * switch on node type
    * No match on rule <default>
    * Using default rule
    * Executing rule <default>
    * Executing crumb action add link to node
    * Added 1 crumb(s)
    * Leave

This shows exactly which rules are used and how the actions are handled.

For large configuration, it might be helpful to see the configuration in a
graph. This can be done using the DOT export function and Graphviz (see 6).

6. Exporting / importing
------------------------
The Hansel export module provides three ways of exporting your configuration:

    * Via features module.
    * Dump of your whole configuration, importable at every Hansel installation.
    * Export as DOT file, for visualisation using Graphviz.

For features integration, check the features admin page. Other exports are
available under the "Export" tab. There is also an "Import" tab available where
you can import any Hansel configuration dump.

7. Extending hansel
--------------------------------------------------------------------------------
Developers can extend the list of available breadcrumb actions and switches by
implementing the hooks which Hansel provides.

7.1. Writing actions
--------------------
Breadcrumb actions can be added by the hansel_action_types hook. Take a look at
hansel.module and hansel_taxonomy.module for examples.

Any implementation of this hook must always return an associative array where
the keys are the names of the actions and the values are associative arrays with
the action information. In PHP, this structure is as follows:

  array(
    'action name' => array(
      'get crumbs' => 'callback to generate the breadcrumbs',
      'info' => 'callback to generate the function line',
      'config form' => 'callback to generate the config form',
      'file' => 'file.containing.callbacks.inc',
      'show token list' => FALSE,
    ),
    ...
  )

This array may contain 0..N actions. The elements 'info', 'config form',
'file' and 'show token list' are optional. The callbacks are function names.

The 'get crumbs' callback takes the array $arguments as it's only argument. This
array contains the values from the config form. This function must return an
array with 0 or more elements (1 element per link) in the following format:

  array(
    array(
      'title' => 'text',
      'href' => 'link'
    ),
    ...
  )

Always use hansel_arg() instead of arg() within this callback function.
hansel_arg() may return parts of the test path given in the test tab (see
chapter 4: Testing your configuration).

The 'info' callback also takes only the $arguments array as it's only argument.
This function must return a string with information of what this action does.
A string must be in plain text and something like "add link to something".

The 'config form' callback also takes only the $arguments array as it's only
argument. It must generate a valid form! There is no need to write a submit
handler, values are stored automatically by Hansel with the same names as used
for the form elements. These values are passed to the callbacks in the
$arguments array. You have to fill the #default_value for the form elements
with the values from $arguments. Please be aware that $arguments may be an empty
array!

The value for 'file' is the filename where the callbacks resides. This file must
be in the module's folder (from the module implementing this hook). No file is
included when this value is omitted.

When 'show token list' is set to TRUE, the action configuration form shows the
list of available tokens. This setting defaults to FALSE.

7.2. Writing switches
---------------------
Switches can be added by the hansel_switch_types hook. Take a look at
hansel.module and hansel_domain.module for examples.

Any implementation of this hook must always return an associative array where
the keys are the names of the switches and the values are associative arrays
with the switch information. In PHP, this structure is as follows:

  array(
    'switch name' => array(
      'compare' => 'callback to compare the value',
      'info' => 'callback to generate the function line',
      'config form' => 'callback to generate the config form',
      'file' => 'file.containing.callbacks.inc',
    ),
    ...
  )

This array may contain 0..N switches. The items 'info', 'config form' and 'file'
are optional. The values for the callbacks are function names.

All callbacks take the array $arguments as its first argument. This array
contains the values from the configuration form.

The 'compare' function has a second argument which is the string $value. When
executing this rule, this function is called for each child rule. The rule name
for that child rule is passed as $value. This callback must return TRUE when
this should be the next rule to be processed and FALSE otherwise.

The 'info' callback also takes only the $arguments array as it's only argument.
This function must return a string with information of what this switch does.
A string must be in plain text and something like "node type" (which is
displayed to the user as "switch on node type").

The 'config form' callback also takes only the $arguments array as it's only
argument. It must generate a valid form! There is no need to write a submit
handler, values are stored automatically by Hansel with the same names as used
for the form elements. These values are passed to the callbacks in the
$arguments array. You have to fill the #default_value for the form elements
with the values from $arguments. Please be aware that $arguments may be an empty
array!

The value for 'file' is the filename where the callbacks resides. This file must
be in the module's folder (from the module implementing this hook). No file is
included when this value is omitted.

8. Helper function for theming
--------------------------------------------------------------------------------
bool hansel_breadcrumb_was_restored()
  Returns TRUE if the "restore breadcrumbs" functionality was triggered.

File

README.txt
View source
  1. PREFACE
  2. -------
  3. Hansel (named after Hansel and Gretel) provides custom breadcrumbs which are
  4. build by user defined rules. These rules are independent from the menu system.
  5. Rules can have logic switches and can add links to the breadcrumbs.
  6. This module is designed for site builders, not for editors. Configuring Hansel
  7. is more difficult than just a few clicks and requires a good understanding of
  8. the rules (see chapter 2: Configuration).
  9. QUICKSTART
  10. ----------
  11. For advanced users who dislike reading, you may skip to chapter 3 to take a look
  12. at the example configurations.
  13. CONTENTS
  14. --------
  15. 1. Installation
  16. 2. Configuration
  17. 2.1. Breadcrumb actions
  18. 2.1.1. Add domain
  19. 2.1.2. Add single link
  20. 2.1.3. Add link to node
  21. 2.1.4. Add link to nodetype
  22. 2.1.5. Add link to user
  23. 2.1.6. Add link to current page
  24. 2.1.7. Add term path
  25. 2.1.8. Add forum path
  26. 2.1.9. Add og path (organic group context)
  27. 2.1.10. Add parents
  28. 2.2. Logical actions
  29. 2.2.1. Goto rule
  30. 2.2.2. Leave
  31. 2.2.3. Switch
  32. 2.2.3.1. Subdomain
  33. 2.2.3.2. Domain id
  34. 2.2.3.3. Url argument
  35. 2.2.3.4. Node id
  36. 2.2.3.5. Node type
  37. 2.2.3.6. Node age
  38. 2.2.3.7. Path alias
  39. 2.2.3.8. PHP
  40. 2.2.3.9. Vocabulary name
  41. 2.2.3.10. Request uri
  42. 3. Example configurations
  43. 3.1. Basic configuration
  44. 3.2. Blogs and news
  45. 3.3. Montly archive
  46. 3.4. Multidomain setup
  47. 4. Settings
  48. 5. Testing your configuration
  49. 6. Exporting / importing
  50. 7. Extending hansel
  51. 7.1. Writing actions
  52. 7.2. Writing switches
  53. 8. Helper function for theming
  54. 1. Installation
  55. --------------------------------------------------------------------------------
  56. Copy Hansel into your modules directory (i.e. sites/all/modules) and enable
  57. Hansel (on admin/build/modules). You may also want to enable the extra modules:
  58. * Hansel Domain
  59. Provides integration with the domain module.
  60. * Hansel Export
  61. Allows you to export and import the whole Hansel configuration.
  62. Not required for features integration.
  63. * Hansel Forum
  64. Provides integration with the forum module.
  65. * Hansel OG
  66. Provides integration with the Organic Groups module.
  67. * Hansel Taxonomy
  68. Provides integration with the taxonomy module.
  69. Add the "administer hansel" permission to the roles that may access the Hansel
  70. configuration page. No permission is required to view the breadcrumbs. You can
  71. skip this step if only the admin user may access the configuration page.
  72. 2. Configuration
  73. --------------------------------------------------------------------------------
  74. After installation, the configuration page will be available at
  75. admin/build/hansel. On this page you'll see a form to add a rule. It is
  76. important to know that Hansel configurations only contains rules. A rule has
  77. four properties:
  78. * Name
  79. This name is used for identification and used by switches (explained later).
  80. * Parent
  81. The parent item in the hierarchy. Rules can be organized in a hierarchical
  82. structure.
  83. * Action with breadcrumbs:
  84. This specifies what links need to be added the the breadcrumbs when this rule
  85. is executed. You may only specify one action per rule (some actions may add
  86. multiple links, however).
  87. * Logical action:
  88. Defines what needs to be done after executing this rule.
  89. The hierarchical structure is used by switches, but has no affect on other
  90. logical actions, and thus may be used to organize the rules manually.
  91. Generating the breadcrumbs always starts with the rule named "start" on the
  92. topmost hierarchical level (known as root). The process can end in three ways:
  93. * With the "leave" action (see 2.2.2)
  94. * With a switch without matching rule (see 2.2.3)
  95. * On recursion caused by improper configured goto rules (see 2.2.1)
  96. After the process has ended, the breadcrumbs will be replaced by the links which
  97. were created by the breadcrumb actions (see 2.1). In some cases, however, the
  98. original breadcrumbs may be restored (see 2.2.2).
  99. Existing rules are shown on the configuration page (admin/build/hansel) in the
  100. hierarchical structure, ordered alphabetically (except the start rule, which is
  101. displayed on top). All rules have an edit and a delete button in the grey bar
  102. containing the rule name.
  103. 2.1. Breadcrumb actions
  104. -----------------------
  105. Breadcrumb actions can add links to the breadcrumbs. A single action may add
  106. multiple links, but may also add no links at all.
  107. When adding a rule, you can select the action in the dropdown box with the title
  108. "Action with breadcrumbs". Some actions have configuration options, those are
  109. shown after clicking the "next" button.
  110. In the overview, the breadcrumb action is displayed right below the rule name.
  111. 2.1.1. Add domain
  112. -----------------
  113. This action is only available when the hansel_domain module is enabled. It adds
  114. the current domain name pointing to the domain path.
  115. For more information about what domains are in this context, read the readme
  116. file of the domain module, or visit http://drupal.org/project/domain
  117. 2.1.2. Add single link
  118. ----------------------
  119. Adds a single - static - link to the breadcrumbs. This action has three
  120. configuration options:
  121. * Link title
  122. The visible text of the link.
  123. * Translate title
  124. Make the link title available for translation.
  125. * Link path
  126. Destination of the link. Do not use leading or trailing slashes. Use ""
  127. to link to the frontpage or "" to output the crumb as plaintext.
  128. You may use "[arg-N]", which will be replaced by the url argument. "N" must be
  129. replaced by the argument number, where 1 is the first argument. Tokens provided
  130. by the token module (http://drupal.org/project/token) are also available.
  131. 2.1.3. Add link to node
  132. -----------------------
  133. When on node pages (thus having "node/%" as path), this will add a link to that
  134. node. The node title is used as link text.
  135. 2.1.4. Add link to nodetype
  136. -----------------------
  137. When on node pages (thus having "node/%" as path) or on node add pages
  138. ("node/add/%"), this will add a link with the nodetype as title, linking to a
  139. configurable path (defaults to "node/add/[type]"). There are 2 tokens available,
  140. [type], which will be replaced by the machine name of the nodetype with hyphens
  141. ("news-feed") and [type-raw], which will be replaced by the original machine
  142. name ("news_feed").
  143. 2.1.5. Add link to user
  144. -----------------------
  145. When on user pages (thus having user/% as path), a link to the user profile of
  146. that user is added to the breadcrumbs.
  147. When on node pages (thus having node/% as path), a link to the node author's
  148. user profile is added.
  149. You can configure the text which is used for links to the profile of the current
  150. user. You may enter something like "Your account". This field is optional, the
  151. username of the current user will be used if empty.
  152. A checkbox is available to use the realname provided by the realname module
  153. instead of the username. This option is only visible when the "realname" module
  154. is enabled.
  155. 2.1.6. Add link to current page
  156. -------------------------------
  157. This will add a link to the current page, with the page title used as link text.
  158. No link is added if the page title is empty.
  159. 2.1.7. Add term path
  160. --------------------
  161. This action is only available when the hansel_taxonomy module is enabled. When
  162. on node pages (thus having node/% as path), this will add the taxonomy term path
  163. for that node to the breadcrumbs. You may force this action to only take terms
  164. from a specified vocabulairy. By default, all vocabulairies are used.
  165. 2.1.8. Add forum path
  166. ---------------------
  167. Adds the forum path. This works for topic listings ("forum/%") and forum nodes.
  168. The containers are not added to the path by default. There is a configuration
  169. option to change this behavior.
  170. 2.1.9. Add og path (organic group context)
  171. ------------------------------------------
  172. This actions adds a link to the group node, where the current node belongs to.
  173. The Hansel OG module must be installed in order to have this action available.
  174. 2.1.10. Add parents
  175. -------------------
  176. Adds the parent pages to the breadcrumbs. Hansel will use the menu-structure to
  177. get the parents. Other modules may extend this to use other relations as well.
  178. 2.2. Logical actions
  179. --------------------
  180. Each rule has a logical action, which is "goto rule", "leave" or "switch". This
  181. action defines what is going to happen after this rule is executed. All actions
  182. have a configuration option, which is displayed after clicking the "next" button
  183. when addding or editing a rule.
  184. 2.2.1. Goto rule
  185. ----------------
  186. After this rule is executed, we will execute another rule. That rule is
  187. specified in the configuration. The destination may be anywhere in the
  188. hierarchical structure.
  189. 2.2.2. Leave
  190. ------------
  191. End the breadcrumb generation process as described in the introduction of this
  192. chapter.
  193. You may optionally check the "Restore original breadcrumbs" box. If checked,
  194. the original breadcrumbs (generated by Drupal core) will be used instead of the
  195. breadcrumbs generated by Hansel. This is usefull for sections where you do not
  196. want to override the breadcrumbs (like the admin section, see 3.1).
  197. 2.2.3. Switch
  198. -------------
  199. The switch action is like the goto action, but can go to different destinations,
  200. depending on the chosen "switch action".
  201. A switch action is, for example, "node type". This action has a value, which
  202. is the node type for the currently displayed node, for example "story". This
  203. value is compared with the rule names of the child rules of the switch rule.
  204. For example we have four rules configured:
  205. Name: start
  206. Action: switch on node type
  207. Name: page (child rule of "start")
  208. Name: story
  209. Name:
  210. The rule "start" has "switch" as logical action with "node type" as switch type.
  211. On a node page with nodetype "story", the rule "story" is the next rule that
  212. will be executed. On page nodes, the rule "page" is executed. If there is no
  213. corresponding rule to the node type, or if we aren't at a node page at all, the
  214. rule with name "" is executed. The default rule is recognised by the
  215. name, and thus always must be named "". If no matching rule is found
  216. and the default rule is missing, the breadcrumb generation process will end as
  217. described in the introduction of this chapter.
  218. Switches may implement the special empty-rule (rule with the name "").
  219. This rule is used when the value is empty. This function is only available for
  220. the "url argument" switch.
  221. Switches may have its own configuration options. You don't see them when adding
  222. a rule, but you can find them by clicking on the switch type name on the
  223. configuration page (admin/build/hansel).
  224. 2.2.3.1. Subdomain
  225. ------------------
  226. This action is only available when the hansel_domain module is enabled. It uses
  227. the subdomain name for the current domain as value to switch on. The subdomain
  228. is likely something is "something.example.com". This is the value of the
  229. "Domain" field under the "Create domain record" tab (on
  230. admin/build/domain/create).
  231. 2.2.3.2. Domain id
  232. ------------------
  233. This action is like the "subdomain" action, but uses the domain id instead of
  234. subdomain. The domain id is found on the domain list (admin/build/domain). The
  235. advantage of using the domain id instead of the subdomain is that you may rename
  236. the domain without having to change the Hansel rules. However, using the
  237. subdomain provides more readability to the Hansel configuration.
  238. 2.2.3.3. Url argument
  239. ---------------------
  240. This switch type compares the rule names with a part of the URL path (called
  241. arguments). By default, the first argument is used, but this can be changed on
  242. the switch configuration page. You can get there by clicking on "url argument"
  243. on the main page (admin/build/hansel). There are three options available:
  244. * The url argument number (1 is the first argument).
  245. * Case sensitive matching (disabled by default).
  246. * Match rules by regular expressions (disabled by default).
  247. The first argument can be something like "node" or "admin". URL arguments never
  248. includes slashes.
  249. There is a special "" rule available for this switch. Rules with this
  250. name matches the frontpage. Its working is independent of the url argument
  251. number configured for this switch.
  252. 2.2.3.4. Node id
  253. ----------------
  254. Switches on the node id of the current displayed node. This only has a value
  255. on paths starting with "node/%".
  256. 2.2.3.5. Node type
  257. ------------------
  258. Switches on the node type of the current displayed node, like "story" or "page".
  259. This only has a value on paths starting with "node/%".
  260. 2.2.3.6. Node age
  261. -----------------
  262. Switches on the age of a node based on node creation time. Subrules can be named
  263. as ranges ("0-1") or with an operator ("< 2"). The unit definition can be
  264. changed in the rule configuration form. When set to 1 day, "0-1" means between
  265. 0 and 1 days old. This includes an age of 0 seconds, but not an age of exactly
  266. one day (86400 seconds). The following operators are available: "<", ">", "<="
  267. and ">=". Numbers may contain floating points, where only a dot is allowed as
  268. decimal separator.
  269. 2.2.3.7. Path alias
  270. -------------------
  271. Switches on the alias for the current path. By default, child rules matches when
  272. the alias starts with the rule name. You can change this behaviour in the switch
  273. configuration page, where you can choose between 4 modes:
  274. * starts with (rule "content" matches on path "content/first-story")
  275. * ends with (rule "story" matches on path "content/first-story")
  276. * contains (rule "first" matches on path "content/first-story")
  277. * matches regular expression (rule "[a-z]{5}" matches on path
  278. content/first-story).
  279. Matching is case insensitive by default. You can turn on case sensitive matching
  280. on the switch configuration page.
  281. 2.2.3.8. PHP
  282. ------------
  283. Switch on the result of custom PHP code. The code must be entered between
  284. and must return the value to switch on.
  285. In order to be able to configure switches from this type, you need the
  286. "use PHP for hansel configuration" permission.
  287. 2.2.3.9. Vocabulary name
  288. ------------------------
  289. Switch on the name of the vocabulary. This works on the term pages
  290. (taxonomy/term/%). Matching is always case insensitive.
  291. 2.2.3.10. Request uri
  292. ---------------------
  293. Switch on the request uri (like "/user"). By default, child rules matches when
  294. the uri starts with the rule name. You can change this behaviour in the switch
  295. configuration page, where you can choose between 4 modes:
  296. * starts with (rule "content" matches on path "content/first-story")
  297. * ends with (rule "story" matches on path "content/first-story")
  298. * contains (rule "first" matches on path "content/first-story")
  299. * matches regular expression (rule "[a-z]{5}" matches on path
  300. content/first-story).
  301. Matching is case insensitive by default. You can turn on case sensitive matching
  302. on the switch configuration page.
  303. 3. Example configurations
  304. --------------------------------------------------------------------------------
  305. This section contains some example configuration. This shows how Hansel is
  306. intended to be used and what the most efficient way is to take control of your
  307. breadcrumbs.
  308. 3.1. Basic configuration
  309. ------------------------
  310. Name: start (process always start with the rule named "start", see chapter 2).
  311. Breadcrumb action: add link "Home" (use "" as path)
  312. Logic action: switch on url argument 1
  313. Name: admin
  314. Breadcrumb action: none
  315. Logic action: leave (restore original breadcrumbs)
  316. Name: node
  317. Breadcrumb action: none
  318. Logic action: switch on node type
  319. Name:
  320. Breadcrumb action: add link to node
  321. Logic action: leave
  322. Name: user
  323. Breadcrumb action: add link to user
  324. Logic action: leave
  325. This leaves the breadcrumbs for the admin section untouched. Other possibilities
  326. for the first url argument are "node" and "user". For user pages, this will
  327. generate the breadcrumb "Home > Username" or "Home > Your Account" if you filled
  328. in "Your Account" in the breadcrumb action configuration (see 2.1.4). On node
  329. pages this will always have the breadcrumb "Home > Node title". For the reason
  330. why whe didn't set the "add link to node" action on the rule "node", take at
  331. look at the blog example (see 3.1).
  332. 3.2. Blogs and news
  333. -------------------
  334. Name: start (process always start with the rule named "start", see chapter 2).
  335. Breadcrumb action: add link "Home" (use "" as path)
  336. Logic action: switch on url argument 1
  337. Name: admin
  338. Breadcrumb action: none
  339. Logic action: leave (restore original breadcrumbs)
  340. Name: blogs
  341. Breadcrumb action: add single link (with the text "Blogs")
  342. Logic action: goto rule "add blog link"
  343. Name: add blog link
  344. Breadcrumb action: add link to user
  345. Logic actions: goto rule ""
  346. Name: news
  347. Breadcrumb action: add single link (with the text "News")
  348. Logic action: goto rule ""
  349. Name: node
  350. Breadcrumb action: none
  351. Logic action: switch on node type
  352. Name: blog
  353. Breadcrumb action: add single link (with the text "Blogs")
  354. Logic action: goto rule "blogs"
  355. Name: news
  356. Breadcrumb action: none
  357. Logic action: goto rule "news" (under "start", not this rule!)
  358. Name:
  359. Breadcrumb action: add link to node
  360. Logic action: leave
  361. Name: user
  362. Breadcrumb action: add link to user
  363. Logic action: leave
  364. Compared to the basic configuration, we have added 2 rules containing node
  365. types, which are "blog" and "news". The "news" rule goes to the rule "news"
  366. under "start", which is a rule we use for the whole news section. That rule adds
  367. the link "News" to the breadcrumbs, linking to "news", which is our news
  368. overview page. After adding that link, we would also like to add a link to the
  369. node. However, we cannot add multiple breadcrumb actions to one rule. The
  370. easiest way to do this is to set the logic action to go to the rule "",
  371. which will add the link to the node, resulting in breadcrumbs like
  372. "Home > News > My news item". The news overview page also ends at the default
  373. rule. However, that rule does not add any links since the overview page is not
  374. a node page. Thus the news overview will have the breadcrumbs "Home > News".
  375. For the blogs, we want breadcrumbs like "Home > Blogs > Author's name > Title".
  376. We need an extra rule to add the author's name in the crumbs. You can see this
  377. in the example. The "blogs" rule adds the link to to "Blogs", then the rule
  378. "add blog link" adds the author's username and at last the "" rule
  379. adds the link to the actual blogpost.
  380. 3.3. Montly archive
  381. -------------------
  382. The views module (http://drupal.org/project/views) provides a default view
  383. "archive". This page provides a list of nodes per month. The path of this view
  384. is "archive", clicking on a month leads to a page on "archive/201004" (for April
  385. 2010). The following example configuration provides the breadcrumbs
  386. "Montly archive > April 2010".
  387. Name: start (process always start with the rule named "start", see chapter 2).
  388. Breadcrumb action: add link "Home" (use "" as path)
  389. Logic action: switch on url argument 1
  390. Name: archive
  391. Breadcrumb action: add link "Montly archive" (use "archive" as path)
  392. Logic action: switch on url argument 2 with regular expressions
  393. Name: [0-9]{6}
  394. Breadcrumb action: add link to current page
  395. Logic action: leave
  396. Note that you have to change the default settings for the url argument switch
  397. (see 2.2.3.3. Url argument).
  398. 3.4. Multidomain setup
  399. ----------------------
  400. There are several ways of how you can configure Hansel when using domains. When
  401. you want to have "Home" as the first element for the main domain, and the domain
  402. name for other domains, without configuring the breadcrumbs per domain, we
  403. suggest the following configuration:
  404. Name: start
  405. Breadcrumb action: none
  406. Logic action: switch on domain id
  407. Name: 0
  408. Breadcrumb action: add link "Home" (use "" as path)
  409. Logic action: goto rule "all domains"
  410. Name:
  411. Breadcrumb action: add link to domain
  412. Logic action: goto rule "all domains"
  413. Name: all domains
  414. Breadcrumb action: none
  415. Logic action: switch on url argument 1
  416. Name: admin
  417. Breadcrumb action: none
  418. Logic action: leave (restore original breadcrumbs)
  419. Name: node
  420. Breadcrumb action: none
  421. Logic action: switch on node type
  422. Name:
  423. Breadcrumb action: add link to node
  424. Logic action: leave
  425. Name: user
  426. Breadcrumb action: add link to user
  427. Logic action: leave
  428. 4. Settings
  429. --------------------------------------------------------------------------------
  430. A settings page is available on admin/build/hansel/settings. Available options
  431. are:
  432. Render last item as a link
  433. Determines if the last item of the breadcrumb is a link (checked by default).
  434. Hide last item
  435. Remove the last item of the breadcrumb.
  436. Maximum length for individual items
  437. Maximum length in characters. Use 0 to disable trimming.
  438. Trim on word boundary
  439. Try to trim on whole words. Titles are still trimmed within words if we would
  440. lose more than 66% of the characters by this action.
  441. Ellipsis
  442. Text to add after trimmed texts. You may leave this empty.
  443. Maximum number of items
  444. Maximum number of breadcrumb items. Items will be removed from the middle.
  445. Use 0 to disable.
  446. Removed items replacement
  447. Removed breadcrumb items will be replaced by this text. Leave empty to
  448. disable.
  449. Remove first item from Hansel path token
  450. The [hansel-path] token should not contain a "Home" item. Check this box if
  451. the first item of the breadcrumbs is something which should not show in your
  452. path aliases.
  453. Cache
  454. Only parts which require interaction with the database are cached. Enabling
  455. this cache is only recommended when you use an efficient caching system (such
  456. as memcache). Note that Hansel uses cache only per action / switch. The output
  457. of the add term path action is cached per node, for example.
  458. Set active menu item
  459. Set the active menu item based on the breadcrumbs. For example: if your
  460. breadcrumbs are News > Archive > 2008, it will activate the same menu item.
  461. If "2008" is not a menu item, it will activate "Archive". If that's not a menu
  462. item either it will only active "News" if present as a root element.
  463. Skip first crumb
  464. Ignore the first item of the breadcrumbs when looking for a corresponding menu
  465. item. Check this box if the first item of the breadcrumbs is something like
  466. "Home" or "Start".
  467. Set active menu name for current path
  468. The "Restore original breadcrumbs" option for the "Leave" action will only
  469. work for the default menu if this box is not checked. But checking this box
  470. can sometimes result in side-effects.
  471. 5. Testing your configuration
  472. --------------------------------------------------------------------------------
  473. Click on the tab "test", this will lead you to admin/build/hansel/test. On this
  474. page you can fill in a path from which you do want to know what the breadcrumbs
  475. for that page will look like.
  476. Hansel tells you how the breadcrumbs are generated. This trace may look like:
  477. * Executing rule start
  478. * Executing crumb action add single link
  479. * Added 1 crumb(s)
  480. * switch on url argument
  481. * No match on rule admin
  482. * Match on rule node
  483. * Executing rule node
  484. * switch on node type
  485. * No match on rule
  486. * Using default rule
  487. * Executing rule
  488. * Executing crumb action add link to node
  489. * Added 1 crumb(s)
  490. * Leave
  491. This shows exactly which rules are used and how the actions are handled.
  492. For large configuration, it might be helpful to see the configuration in a
  493. graph. This can be done using the DOT export function and Graphviz (see 6).
  494. 6. Exporting / importing
  495. ------------------------
  496. The Hansel export module provides three ways of exporting your configuration:
  497. * Via features module.
  498. * Dump of your whole configuration, importable at every Hansel installation.
  499. * Export as DOT file, for visualisation using Graphviz.
  500. For features integration, check the features admin page. Other exports are
  501. available under the "Export" tab. There is also an "Import" tab available where
  502. you can import any Hansel configuration dump.
  503. 7. Extending hansel
  504. --------------------------------------------------------------------------------
  505. Developers can extend the list of available breadcrumb actions and switches by
  506. implementing the hooks which Hansel provides.
  507. 7.1. Writing actions
  508. --------------------
  509. Breadcrumb actions can be added by the hansel_action_types hook. Take a look at
  510. hansel.module and hansel_taxonomy.module for examples.
  511. Any implementation of this hook must always return an associative array where
  512. the keys are the names of the actions and the values are associative arrays with
  513. the action information. In PHP, this structure is as follows:
  514. array(
  515. 'action name' => array(
  516. 'get crumbs' => 'callback to generate the breadcrumbs',
  517. 'info' => 'callback to generate the function line',
  518. 'config form' => 'callback to generate the config form',
  519. 'file' => 'file.containing.callbacks.inc',
  520. 'show token list' => FALSE,
  521. ),
  522. ...
  523. )
  524. This array may contain 0..N actions. The elements 'info', 'config form',
  525. 'file' and 'show token list' are optional. The callbacks are function names.
  526. The 'get crumbs' callback takes the array $arguments as it's only argument. This
  527. array contains the values from the config form. This function must return an
  528. array with 0 or more elements (1 element per link) in the following format:
  529. array(
  530. array(
  531. 'title' => 'text',
  532. 'href' => 'link'
  533. ),
  534. ...
  535. )
  536. Always use hansel_arg() instead of arg() within this callback function.
  537. hansel_arg() may return parts of the test path given in the test tab (see
  538. chapter 4: Testing your configuration).
  539. The 'info' callback also takes only the $arguments array as it's only argument.
  540. This function must return a string with information of what this action does.
  541. A string must be in plain text and something like "add link to something".
  542. The 'config form' callback also takes only the $arguments array as it's only
  543. argument. It must generate a valid form! There is no need to write a submit
  544. handler, values are stored automatically by Hansel with the same names as used
  545. for the form elements. These values are passed to the callbacks in the
  546. $arguments array. You have to fill the #default_value for the form elements
  547. with the values from $arguments. Please be aware that $arguments may be an empty
  548. array!
  549. The value for 'file' is the filename where the callbacks resides. This file must
  550. be in the module's folder (from the module implementing this hook). No file is
  551. included when this value is omitted.
  552. When 'show token list' is set to TRUE, the action configuration form shows the
  553. list of available tokens. This setting defaults to FALSE.
  554. 7.2. Writing switches
  555. ---------------------
  556. Switches can be added by the hansel_switch_types hook. Take a look at
  557. hansel.module and hansel_domain.module for examples.
  558. Any implementation of this hook must always return an associative array where
  559. the keys are the names of the switches and the values are associative arrays
  560. with the switch information. In PHP, this structure is as follows:
  561. array(
  562. 'switch name' => array(
  563. 'compare' => 'callback to compare the value',
  564. 'info' => 'callback to generate the function line',
  565. 'config form' => 'callback to generate the config form',
  566. 'file' => 'file.containing.callbacks.inc',
  567. ),
  568. ...
  569. )
  570. This array may contain 0..N switches. The items 'info', 'config form' and 'file'
  571. are optional. The values for the callbacks are function names.
  572. All callbacks take the array $arguments as its first argument. This array
  573. contains the values from the configuration form.
  574. The 'compare' function has a second argument which is the string $value. When
  575. executing this rule, this function is called for each child rule. The rule name
  576. for that child rule is passed as $value. This callback must return TRUE when
  577. this should be the next rule to be processed and FALSE otherwise.
  578. The 'info' callback also takes only the $arguments array as it's only argument.
  579. This function must return a string with information of what this switch does.
  580. A string must be in plain text and something like "node type" (which is
  581. displayed to the user as "switch on node type").
  582. The 'config form' callback also takes only the $arguments array as it's only
  583. argument. It must generate a valid form! There is no need to write a submit
  584. handler, values are stored automatically by Hansel with the same names as used
  585. for the form elements. These values are passed to the callbacks in the
  586. $arguments array. You have to fill the #default_value for the form elements
  587. with the values from $arguments. Please be aware that $arguments may be an empty
  588. array!
  589. The value for 'file' is the filename where the callbacks resides. This file must
  590. be in the module's folder (from the module implementing this hook). No file is
  591. included when this value is omitted.
  592. 8. Helper function for theming
  593. --------------------------------------------------------------------------------
  594. bool hansel_breadcrumb_was_restored()
  595. Returns TRUE if the "restore breadcrumbs" functionality was triggered.