You are here

function xmlrpc_test_xmlrpc_alter in Drupal 7

Implements hook_xmlrpc_alter().

Hide (or not) the system.methodSignature() service depending on a variable.

1 string reference to 'xmlrpc_test_xmlrpc_alter'
XMLRPCMessagesTestCase::testAlterListMethods in modules/simpletest/tests/xmlrpc.test
Ensure that hook_xmlrpc_alter() can hide even builtin methods.

File

modules/simpletest/tests/xmlrpc_test.module, line 70

Code

function xmlrpc_test_xmlrpc_alter(&$services) {
  if (variable_get('xmlrpc_test_xmlrpc_alter', FALSE)) {
    $remove = NULL;
    foreach ($services as $key => $value) {
      if (!is_array($value)) {
        continue;
      }
      if ($value[0] == 'system.methodSignature') {
        $remove = $key;
        break;
      }
    }
    if (isset($remove)) {
      unset($services[$remove]);
    }
  }
}