function hook_xmlrpc_alter
hook_xmlrpc_alter(&$methods)
Alters the definition of XML-RPC methods before they are called.
This hook allows modules to modify the callback definition of declared XML-RPC methods, right before they are invoked by a client. Methods may be added, or existing methods may be altered.
Note that hook_xmlrpc() supports two distinct and incompatible formats to define a callback, so care must be taken when altering other methods.
Parameters
$methods: An asssociative array of method callback definitions, as returned from hook_xmlrpc() implementations.
See also
Related topics
File
- modules/system/system.api.php, line 2452
- Hooks provided by Drupal core and the System module.
Code
function hook_xmlrpc_alter(&$methods) { // Directly change a simple method. $methods['drupal.login'] = 'mymodule_login'; // Alter complex definitions. foreach ($methods as $key => &$method) { // Skip simple method definitions. if (!is_int($key)) { continue; } // Perform the wanted manipulation. if ($method[0] == 'drupal.site.ping') { $method[1] = 'mymodule_directory_ping'; } } }
© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/modules!system!system.api.php/function/hook_xmlrpc_alter/7.x