function rest_server_response_formatters in Services 7.3
Same name and namespace in other branches
- 6.3 servers/rest_server/rest_server.module \rest_server_response_formatters()
Builds a list of response formatters that are available to the RESTServer.
Return value
array An associative array of formatter info arrays keyed by type extension. The formatter info specifies an array of 'mime types' that corresponds to the output format; a 'view' class that is a subclass of RESTServerView; and 'view arguments' that should be passed to the view when it is created;
2 calls to rest_server_response_formatters()
- rest_server_setup_settings in servers/
rest_server/ rest_server.module - Set up settings for a rest server endpoint, fills the settings array with defaults. This is done to ensure that the default state is consistent between what's shown by default in the settings form and used by default by the REST server if it…
- ServicesRESTServerFactory::getFormatters in servers/
rest_server/ includes/ ServicesRESTServerFactory.inc
File
- servers/
rest_server/ rest_server.module, line 81
Code
function rest_server_response_formatters() {
static $formatters = NULL;
if (!$formatters) {
$formatters = array(
'xml' => array(
'mime types' => array(
'application/xml',
'text/xml',
),
'formatter class' => 'ServicesXMLFormatter',
),
'json' => array(
'mime types' => array(
'application/json',
),
'formatter class' => 'ServicesJSONFormatter',
),
'jsonp' => array(
'mime types' => array(
'text/javascript',
'application/javascript',
),
'formatter class' => 'ServicesJSONPFormatter',
),
'php' => array(
'mime types' => array(
'application/vnd.php.serialized',
),
'formatter class' => 'ServicesPHPFormatter',
),
'bencode' => array(
'mime types' => array(
'application/x-bencode',
),
'formatter class' => 'ServicesBencodeFormatter',
),
);
if (($library = libraries_load('spyc')) && !empty($library['loaded'])) {
$formatters['yaml'] = array(
'mime types' => array(
'text/plain',
'application/x-yaml',
'text/yaml',
),
'formatter class' => 'ServicesYAMLFormatter',
);
}
drupal_alter('rest_server_response_formatters', $formatters);
}
return $formatters;
}