diff options
author | Cash Costello <cash.costello@gmail.com> | 2011-07-06 07:51:51 -0400 |
---|---|---|
committer | Cash Costello <cash.costello@gmail.com> | 2011-07-06 07:51:51 -0400 |
commit | b4f9682d2dae28db4ee183909be3ae439be2a858 (patch) | |
tree | a7d98cbd977e63df185a72fa539948820fa630ad | |
parent | 105abf94e68860d1d1d06ef6865d21c65f8a4dde (diff) | |
download | elgg-b4f9682d2dae28db4ee183909be3ae439be2a858.tar.gz elgg-b4f9682d2dae28db4ee183909be3ae439be2a858.tar.bz2 |
Fixes #2204 standardized the hooks/overrides for plugin settings and usersettings
-rw-r--r-- | actions/plugins/settings/save.php | 4 | ||||
-rw-r--r-- | actions/plugins/usersettings/save.php | 4 | ||||
-rw-r--r-- | engine/classes/ElggPlugin.php | 13 |
3 files changed, 11 insertions, 10 deletions
diff --git a/actions/plugins/settings/save.php b/actions/plugins/settings/save.php index 3b5694039..e94127f7c 100644 --- a/actions/plugins/settings/save.php +++ b/actions/plugins/settings/save.php @@ -26,8 +26,8 @@ $plugin_name = $plugin->getManifest()->getName(); $result = false; // allow a plugin to override the save action for their settings -if (elgg_action_exists("settings/$plugin_id/save")) { - action("settings/$plugin_id/save"); +if (elgg_action_exists("$plugin_id/settings/save")) { + action("$plugin_id/settings/save"); } else { foreach ($params as $k => $v) { $result = $plugin->setSetting($k, $v); diff --git a/actions/plugins/usersettings/save.php b/actions/plugins/usersettings/save.php index c6214f68d..71ad2ad7b 100644 --- a/actions/plugins/usersettings/save.php +++ b/actions/plugins/usersettings/save.php @@ -39,8 +39,8 @@ if (!$user->canEdit()) { $result = false; -if (elgg_action_exists("usersettings/$plugin_id/save")) { - action("usersettings/$plugin_id/save"); +if (elgg_action_exists("$plugin_id/usersettings/save")) { + action("$plugin_id/usersettings/save"); } else { foreach ($params as $k => $v) { // Save diff --git a/engine/classes/ElggPlugin.php b/engine/classes/ElggPlugin.php index e46ac4273..d837431fc 100644 --- a/engine/classes/ElggPlugin.php +++ b/engine/classes/ElggPlugin.php @@ -315,9 +315,9 @@ class ElggPlugin extends ElggObject { return false; } // Hook to validate setting - $value = elgg_trigger_plugin_hook('plugin:setting', 'plugin', array( - 'plugin' => $this->pluginID, - 'plugin_object' => $this, + $value = elgg_trigger_plugin_hook('setting', 'plugin', array( + 'plugin_id' => $this->pluginID, + 'plugin' => $this, 'name' => $name, 'value' => $value ), $value); @@ -454,10 +454,11 @@ class ElggPlugin extends ElggObject { } // Hook to validate setting - // note this doesn't pass the namespaced name! - $value = elgg_trigger_plugin_hook('plugin:usersetting', 'user', array( + // note: this doesn't pass the namespaced name + $value = elgg_trigger_plugin_hook('usersetting', 'plugin', array( 'user' => $user, - 'plugin' => $this->getID(), + 'plugin' => $this, + 'plugin_id' => $this->getID(), 'name' => $name, 'value' => $value ), $value); |