From de3b6654ddc28fe0fc7d6e1fb615ddb4fd3e3e47 Mon Sep 17 00:00:00 2001 From: cash Date: Mon, 24 Jan 2011 02:02:46 +0000 Subject: welcome to the admin dashboard git-svn-id: http://code.elgg.org/elgg/trunk@7922 36083f99-b078-4883-b0ff-0f9b5a30f544 --- engine/lib/widgets.php | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'engine/lib/widgets.php') diff --git a/engine/lib/widgets.php b/engine/lib/widgets.php index e11e4b8e3..9a092e92d 100644 --- a/engine/lib/widgets.php +++ b/engine/lib/widgets.php @@ -215,12 +215,13 @@ function elgg_is_widget_type($handler) { * * The widget types are stdClass objects. * - * @param string context The widget context or empty string for current context + * @param string $context The widget context or empty string for current context + * @param bool $exact Only return widgets registered for this context (false) * * @return array * @since 1.8.0 */ -function elgg_get_widget_types($context = "") { +function elgg_get_widget_types($context = "", $exact = false) { global $CONFIG; if (empty($CONFIG->widgets) || @@ -236,8 +237,14 @@ function elgg_get_widget_types($context = "") { $widgets = array(); foreach ($CONFIG->widgets->handlers as $key => $handler) { - if (in_array('all', $handler->context) || in_array($context, $handler->context)) { - $widgets[$key] = $handler; + if ($exact) { + if (in_array($context, $handler->context)) { + $widgets[$key] = $handler; + } + } else { + if (in_array('all', $handler->context) || in_array($context, $handler->context)) { + $widgets[$key] = $handler; + } } } -- cgit v1.2.3