Skip to content
This repository has been archived by the owner on Nov 29, 2018. It is now read-only.

Commit

Permalink
fix(tools): fix handling of tool options with custom subtypes
Browse files Browse the repository at this point in the history
  • Loading branch information
hypeJunction committed Jan 7, 2017
1 parent 6e18556 commit baabc9c
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions start.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ function group_subtypes_init() {

elgg_register_entity_type('group', $subtype);

// If a custom form/action has been setup for the subtype,
// apply custom tools logic
elgg_register_plugin_hook_handler('action', "groups/edit/$subtype", 'group_subtypes_update_fields_config');

$identifier = elgg_extract('identifier', $options, 'groups');
if (in_array($identifier, $identifiers)) {
continue;
Expand Down Expand Up @@ -190,6 +194,20 @@ function group_subtypes_router($hook, $type, $return, $params) {
return;
}

// Get original identifier
$identifier = elgg_extract('identifier', $params);
if ($identifier !== 'groups') {
$tools = elgg_get_config('group_tool_options');
// Namespace tool options
foreach ($tools as $key => $tool) {
$tool->label = elgg_echo("$identifier:tools:$tool->name");
// Let group options prevail. Do not enable anything by default
$tool->default_on = false;
$tools[$key] = $tool;
}
elgg_set_config('group_tool_options', $tools);
}

$segments = elgg_extract('segments', $return);
return array(
'identifier' => 'groups',
Expand Down

0 comments on commit baabc9c

Please sign in to comment.