From 40beee7e0a122811516122a388f6aaa5b1b3c2f4 Mon Sep 17 00:00:00 2001 From: ben Date: Thu, 12 Jun 2008 11:16:11 +0000 Subject: Added use_widgets function to register a context for widget use. git-svn-id: https://code.elgg.org/elgg/trunk@881 36083f99-b078-4883-b0ff-0f9b5a30f544 --- engine/lib/widgets.php | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'engine/lib/widgets.php') diff --git a/engine/lib/widgets.php b/engine/lib/widgets.php index baa20b45d..aa12bf76b 100644 --- a/engine/lib/widgets.php +++ b/engine/lib/widgets.php @@ -11,6 +11,25 @@ * @link http://elgg.org/ */ + /** + * Register a particular context for use with widgets. + * + * @param string $context The context we wish to enable context for + */ + function use_widgets($context) { + + global $CONFIG; + if (!isset($CONFIG->widgets)) + $CONFIG->widgets = new stdClass; + if (!isset($CONFIG->widgets->contexts)) { + $CONFIG->widgets->contexts = array(); + } + if (!empty($context)) { + $CONFIG->widgets->contexts[] = $context; + } + + } + /** * Registers a particular action with a widget handler -- cgit v1.2.3