diff --git a/classes/ColdTrick/WidgetManager/Groups.php b/classes/ColdTrick/WidgetManager/Groups.php index 72395b0..efb59e0 100644 --- a/classes/ColdTrick/WidgetManager/Groups.php +++ b/classes/ColdTrick/WidgetManager/Groups.php @@ -72,7 +72,7 @@ public static function updateGroupWidgets(\Elgg\Event $event) { // enable widgets $column_counts = []; - $max_columns = elgg_trigger_plugin_hook('groups:column_count', 'widget_manager', [], 2); + $max_columns = elgg_trigger_plugin_hook('groups:column_count', 'widget_manager', [], elgg_get_plugin_setting('group_column_count', 'widget_manager')); for ($i = 1; $i <= $max_columns; $i++) { $column_counts[$i] = 0; } @@ -192,7 +192,7 @@ public static function getGroupWidgetsLayout(\Elgg\Hook $hook) { // need context = groups to fix the issue with the new group_profile context elgg_push_context('groups'); - $num_columns = (int) elgg_extract('num_columns', $vars, 2); + $num_columns = (int) elgg_extract('num_columns', $vars, elgg_get_plugin_setting('group_column_count', 'widget_manager')); $vars[\Elgg\ViewsService::OUTPUT_KEY] = elgg_view_layout('widgets', [ 'num_columns' => $num_columns, diff --git a/elgg-plugin.php b/elgg-plugin.php index 52ba191..dcf694c 100644 --- a/elgg-plugin.php +++ b/elgg-plugin.php @@ -25,6 +25,7 @@ ], 'bootstrap' => \ColdTrick\WidgetManager\Bootstrap::class, 'settings' => [ + 'group_column_count' => 2, 'widget_layout' => '33|33|33', 'lazy_loading_enabled' => 0, 'lazy_loading_mobile_columns' => 1, diff --git a/languages/en.php b/languages/en.php index 915201d..661081a 100644 --- a/languages/en.php +++ b/languages/en.php @@ -63,6 +63,7 @@ 'widget_manager:settings:group:option_admin_only' => "Only administrator can enable group widgets", 'widget_manager:settings:group:force_tool_widgets' => "Enforce group tool widgets", 'widget_manager:settings:group:force_tool_widgets:confirm' => "Are you sure? This will add/remove all widgets specific to a tool option for all groups (where widget management is enabled).", + 'widget_manager:settings:group:group_column_count' => "Number of widget columns in a group", 'widget_manager:settings:extra_contexts:description' => "Enter the page handler name of the new page which will get a layout similar to the index page. You can add as much pages as you need. Be sure not to add a page handler that is already in use. You can also configure the column layout for that page and optionally assign non-admin users as manager of the page.", 'widget_manager:settings:extra_contexts:page' => "Page", diff --git a/languages/nl.php b/languages/nl.php index 2cb0649..ada3881 100644 --- a/languages/nl.php +++ b/languages/nl.php @@ -58,6 +58,7 @@ 'widget_manager:settings:group:enable' => 'Schakel Widget Manager in voor groepen', 'widget_manager:settings:group:option_default_enabled' => 'Widgets beheer voor groepen standaard ingeschakeld', 'widget_manager:settings:group:option_admin_only' => 'Alleen beheerders kunnen groep widgets inschakelen', + 'widget_manager:settings:group:group_column_count' => 'Aantal widget kolommen in een groep', 'widget_manager:forms:manage_widgets:no_widgets' => 'Geen widgets om te beheren', 'widget_manager:widgets:edit:advanced' => 'Geavanceerd', 'widget_manager:widgets:edit:disable_widget_content_style' => 'Verwijder widget stijl', diff --git a/views/default/plugins/widget_manager/settings.php b/views/default/plugins/widget_manager/settings.php index c75f144..ff64fb4 100644 --- a/views/default/plugins/widget_manager/settings.php +++ b/views/default/plugins/widget_manager/settings.php @@ -82,6 +82,13 @@ 'default' => 'no', 'value' => 'yes', ]); + $group_settings .= elgg_view_field([ + '#type' => 'number', + '#label' => elgg_echo('widget_manager:settings:group:group_column_count'), + 'name' => 'params[group_column_count]', + 'value' => $plugin->group_column_count, + 'min' => 1, + ]); echo elgg_view_module('info', elgg_echo('widget_manager:settings:group'), $group_settings); }