From 4f1f6547956b171181c845d2a03a2d25580f090e Mon Sep 17 00:00:00 2001 From: Matt Beckett Date: Sat, 20 Jul 2013 17:51:25 -0600 Subject: [PATCH 1/4] Adds option for setting group default widgets --- lib/hooks.php | 27 +++++++++++++++++++++++++++ start.php | 1 + 2 files changed, 28 insertions(+) diff --git a/lib/hooks.php b/lib/hooks.php index 6544ff6..a954b52 100644 --- a/lib/hooks.php +++ b/lib/hooks.php @@ -250,4 +250,31 @@ function widget_manager_widgets_url($hook_name, $entity_type, $return_value, $pa } } return $result; + } + + + /** + * Allow for group default widgets + * + * @param unknown_type $hook_name + * @param unknown_type $entity_type + * @param unknown_type $return_value + * @param unknown_type $params + * @return Ambigous + */ + function widget_manager_widgets_url($hook_name, $entity_type, $return_value, $params) { + if (!is_array($return_value)) { + $return_value = array(); + } + + $return_value[] = array( + 'name' => elgg_echo('groups'), + 'widget_context' => 'groups', + 'widget_columns' => 3, + 'event' => 'create', + 'entity_type' => 'group', + 'entity_subtype' => NULL + ); + + return $return_value; } \ No newline at end of file diff --git a/start.php b/start.php index 66346e8..00c361a 100644 --- a/start.php +++ b/start.php @@ -38,6 +38,7 @@ function widget_manager_init(){ } elseif($group_option_enabled) { // register event to make sure newly created groups have the group option enabled elgg_register_event_handler("create", "group", "widget_manager_create_group_event_handler"); + elgg_register_plugin_hook_handler('get_list', 'default_widgets', 'widget_manager_group_widgets_default_list'); } } From 5a49d3153cea452f7314a861a5287dd76ed18e59 Mon Sep 17 00:00:00 2001 From: Matt Beckett Date: Sat, 20 Jul 2013 17:56:57 -0600 Subject: [PATCH 2/4] add feature in readme, set up changes for next version listing this option and credit to funding client --- CHANGES.txt | 4 ++++ README.txt | 1 + 2 files changed, 5 insertions(+) diff --git a/CHANGES.txt b/CHANGES.txt index ca2997f..4b5b53f 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -1,5 +1,9 @@ = Version history: = +4.7 (): +- added: group default widget support +(thanks to Connecting Conservation - griffingroups.com) + 4.6 (2013-06-27): - added: content_by_tag widget also support bookmarks diff --git a/README.txt b/README.txt index 1a96d75..cc49336 100644 --- a/README.txt +++ b/README.txt @@ -5,6 +5,7 @@ - Provides a few new widgets (see below for the widget list) - Forcing of widget (incl positioning) on profile/dashboard (also later!) - Option to globally hide a specific widgettype (will even hide widget already placed on profile/dashboard) + - Create group default widgets Version 4.0 is only for 1.8 and higher Version 3.9.x will be used for 1.7 patches From 68f6b43343f67ff0be43f8704f3de15443e901a1 Mon Sep 17 00:00:00 2001 From: Matt Beckett Date: Sat, 20 Jul 2013 20:16:32 -0600 Subject: [PATCH 3/4] Fix column layout to 2, remove mention of griffingroups site at request of the client --- CHANGES.txt | 2 +- lib/hooks.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGES.txt b/CHANGES.txt index 4b5b53f..22eb2ae 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -2,7 +2,7 @@ 4.7 (): - added: group default widget support -(thanks to Connecting Conservation - griffingroups.com) +(thanks to Connecting Conservation) 4.6 (2013-06-27): diff --git a/lib/hooks.php b/lib/hooks.php index a954b52..2aeb646 100644 --- a/lib/hooks.php +++ b/lib/hooks.php @@ -270,7 +270,7 @@ function widget_manager_widgets_url($hook_name, $entity_type, $return_value, $pa $return_value[] = array( 'name' => elgg_echo('groups'), 'widget_context' => 'groups', - 'widget_columns' => 3, + 'widget_columns' => 2, 'event' => 'create', 'entity_type' => 'group', 'entity_subtype' => NULL From 8f692caf4f047fca6ca2ee9aa80be0a20edd6e8c Mon Sep 17 00:00:00 2001 From: Matt Beckett Date: Tue, 6 Aug 2013 23:24:00 -0600 Subject: [PATCH 4/4] fix handler name --- lib/hooks.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/hooks.php b/lib/hooks.php index 2aeb646..abb61a4 100644 --- a/lib/hooks.php +++ b/lib/hooks.php @@ -262,7 +262,7 @@ function widget_manager_widgets_url($hook_name, $entity_type, $return_value, $pa * @param unknown_type $params * @return Ambigous */ - function widget_manager_widgets_url($hook_name, $entity_type, $return_value, $params) { + function widget_manager_group_widgets_default_list($hook_name, $entity_type, $return_value, $params) { if (!is_array($return_value)) { $return_value = array(); }