]> gitweb.fluxo.info Git - lorea/elgg.git/commitdiff
Fixes #2204 standardized the hooks/overrides for plugin settings and usersettings
authorCash Costello <cash.costello@gmail.com>
Wed, 6 Jul 2011 11:51:51 +0000 (07:51 -0400)
committerCash Costello <cash.costello@gmail.com>
Wed, 6 Jul 2011 11:51:51 +0000 (07:51 -0400)
actions/plugins/settings/save.php
actions/plugins/usersettings/save.php
engine/classes/ElggPlugin.php

index 3b5694039fcb36c53d8270adc9fc390d731c40f6..e94127f7c435752631fb0863a1a8444a625f4339 100644 (file)
@@ -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);
index c6214f68dedcd7ba0b3fc4df00a54fe37ce96ef6..71ad2ad7bf7ae026d912d79b8e5d8160ab9ae884 100644 (file)
@@ -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
index e46ac427398021bdbfe366d9bf566593fd85018f..d837431fce555c22192ba418653c35ad0fec3bc9 100644 (file)
@@ -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);