diff options
author | ben <ben@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2008-06-16 23:32:45 +0000 |
---|---|---|
committer | ben <ben@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2008-06-16 23:32:45 +0000 |
commit | 472aa15c24655c4d978019edaa4669700964325d (patch) | |
tree | 225509f18b563d1bce89f661a1b76ac469c461d3 /engine/lib | |
parent | 05edae9a09b52f4e0aad5c1a6bdfa17eae4426cb (diff) | |
download | elgg-472aa15c24655c4d978019edaa4669700964325d.tar.gz elgg-472aa15c24655c4d978019edaa4669700964325d.tar.bz2 |
Sticky menu items, but also, much more intelligent context detection. Plugin authors need not bother with set_context() any more - the context should be set automatically. This is overruled by page handling settings, if set, which use the first element of the URL to determine context. Fixes #32
git-svn-id: https://code.elgg.org/elgg/trunk@940 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'engine/lib')
-rw-r--r-- | engine/lib/pageowner.php | 2 | ||||
-rw-r--r-- | engine/lib/plugins.php | 3 |
2 files changed, 4 insertions, 1 deletions
diff --git a/engine/lib/pageowner.php b/engine/lib/pageowner.php index 4531b5037..c6bd5bcaf 100644 --- a/engine/lib/pageowner.php +++ b/engine/lib/pageowner.php @@ -139,6 +139,8 @@ if (isset($CONFIG->context) && !empty($CONFIG->context)) {
return $CONFIG->context;
}
+ if ($context = get_plugin_name(true))
+ return $context;
return "main";
}
diff --git a/engine/lib/plugins.php b/engine/lib/plugins.php index f12ed3cac..cc03bba04 100644 --- a/engine/lib/plugins.php +++ b/engine/lib/plugins.php @@ -45,10 +45,11 @@ }
/**
- * Get the name of the most recent plugin to be called in the call stack.
+ * Get the name of the most recent plugin to be called in the call stack (or the plugin that owns the current page, if any).
*
* i.e., if the last plugin was in /mod/foobar/, get_plugin_name would return foo_bar.
*
+ * @param boolean $mainfilename If set to true, this will instead determine the context from the main script filename called by the browser. Default = false.
* @return string|false Plugin name, or false if no plugin name was called
*/
function get_plugin_name($mainfilename = false) {
|