function xmlrpc_test_xmlrpc_alter

Implements hook_xmlrpc_alter().

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

File

drupal/core/modules/xmlrpc/tests/modules/xmlrpc_test/xmlrpc_test.module, line 70

Code

function xmlrpc_test_xmlrpc_alter(&$services) {
  $xmlprc_alter = state()
    ->get('xmlrpc_test.alter') ?: FALSE;
  if ($xmlprc_alter) {
    $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]);
    }
  }
}