The getBreadcrumb method of a module class allows your routed templates to generate breadcrumb entries for use when BigTreeCMS::getBreadcrumb or BigTreeCMS::getBreadcrumbByPage is called. The first step in setting this up is to assign the related module to the routed template via the "Related Module" dropdown when editing a template:
After saving the template, go into your module's class file and implement a simple getBreadcrumb method:
function getBreadcrumb($page) { global $bigtree; if ($bigtree["routed_path"][0] == "details") { $current = $this->get($bigtree["commands"][0]); return array("title" => $current["title"], "link" => "#"); } return array(); }
In this example, we check to see if we're on the details page of the routed template. If so, we use the first command in the commands array and pull an entry from the database. We then serve that entry's title as an additional piece of the breadcrumb. You must always return an array from your getBreadcrumb method even if it is empty.
BigTree 4.3 and later allow for two additional parameters to be passed to your getBreadcrumb call -- $routed_path
and $commands
. These are equivalent to $bigtree["routed_path"]
and $bigtree["commands"]
and are simply convenience parameters so that you do not need to globalize $bigtree
.