function xmlrpc_test_xmlrpc_alter in xmlrpc 8
Implements hook_xmlrpc_alter().
Hide (or not) the system.methodSignature() service depending on a variable.
File
- tests/
modules/ xmlrpc_test/ xmlrpc_test.module, line 176 - Test module to support XmlRpcMessagesTest and XmlRpcValidatorTest.
Code
function xmlrpc_test_xmlrpc_alter(&$services) {
$xmlprc_alter = \Drupal::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]);
}
}
}