diff --git a/CHANGES.txt b/CHANGES.txt index ca2997f..22eb2ae 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -1,5 +1,9 @@ = Version history: = +4.7 (): +- added: group default widget support +(thanks to Connecting Conservation) + 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 diff --git a/lib/hooks.php b/lib/hooks.php index 6544ff6..abb61a4 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_group_widgets_default_list($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' => 2, + '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'); } }