From bdacb612f3fffa967ef6fda89c081fb7a59894d2 Mon Sep 17 00:00:00 2001 From: brettp Date: Thu, 11 Mar 2010 18:07:26 +0000 Subject: Added breadcrumb support and updated the mods with old-style breadcrumbs. git-svn-id: http://code.elgg.org/elgg/trunk@5366 36083f99-b078-4883-b0ff-0f9b5a30f544 --- engine/lib/elgglib.php | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) (limited to 'engine/lib/elgglib.php') diff --git a/engine/lib/elgglib.php b/engine/lib/elgglib.php index 42d6ffc6f..fd270bc1d 100644 --- a/engine/lib/elgglib.php +++ b/engine/lib/elgglib.php @@ -2661,6 +2661,54 @@ function elgg_http_add_url_query_elements($url, array $elements) { return $string; } + +/** + * Breadcrumb support. + */ + +/** + * Adds a breadcrumb to the stack + * + * @param string $title The title to display + * @param string $link Optional. The link for the title. + */ +function elgg_push_breadcrumb($title, $link = NULL) { + global $CONFIG; + if (!is_array($CONFIG->breadcrumbs)) { + $CONFIG->breadcrumbs = array(); + } + + // avoid key collisions. + $CONFIG->breadcrumbs[] = array('title' => $title, 'link' => $link); +} + +/** + * Removes last breadcrumb entry. + * + * @return array popped item. + */ +function elgg_pop_breadcrumb() { + global $CONFIG; + + if (is_array($CONFIG->breadcrumbs)) { + array_pop($CONFIG->breadcrumbs); + } + + return FALSE; +} + +/** + * Returns all breadcrumbs + * + * @return array Breadcrumbs + */ +function elgg_get_breadcrumbs() { + global $CONFIG; + + return (is_array($CONFIG->breadcrumbs)) ? $CONFIG->breadcrumbs : array(); +} + + /** * Returns the PHP INI setting in bytes * -- cgit v1.2.3