function wsclient_rest_has_custom_formatter in Web service client 7
Determines whether custom formatter is defined in settings: "custom" means that it implements the HttpClientFormatter interface but has no corresponding implementation in info hook.
Parameters
string $formatter_type: Either 'send_formatter' or 'receive_formatter'.
Return value
bool
See also
hook_wsclient_rest_formatter_info()
1 call to wsclient_rest_has_custom_formatter()
- WSClientRESTEndpoint::formAlter in wsclient_rest/
wsclient_rest.inc - Adds options to the Web Service config form specific to the REST service.
File
- wsclient_rest/
wsclient_rest.module, line 136 - Web service client endpoint for invoking a RESTful service.
Code
function wsclient_rest_has_custom_formatter($settings, $formatter_type) {
$custom = TRUE;
// In case if valid formatter found configured old-style - skip returning true.
if (wsclient_rest_has_old_formatter($settings)) {
return TRUE;
}
// Empty entry couldn't be custom implementation.
if (empty($settings[$formatter_type]['class'])) {
return FALSE;
}
// If doesn't implement the interface - considered as broken and will be overridden.
if (!new $settings[$formatter_type]['class']() instanceof HttpClientFormatter) {
return FALSE;
}
// Search through the implementations.
$info = module_invoke_all('wsclient_rest_formatter_info');
if (!empty($info[$settings[$formatter_type]['class']])) {
return FALSE;
}
// If none of the above applies, it means that we've finally checked that
// the formatter is really custom.
return $custom;
}