You are here

function hook_es_server_rest_response_formatter_alter in Entity Share 7

Alter the response formatter to manage new response http content types.

Parameters

array $formatter: The formatter callbacks of http content types. Callback must return the formatted response. Example of formatter:

  • array('application/json' => 'mycallback')
  • array('application/json' => array($class, 'mycallback'))
  • array('application/json' => 'function(){}).

File

modules/entity_share_server/entity_share_server.api.php, line 24
Hooks provided by the Entity Share Server module.

Code

function hook_es_server_rest_response_formatter_alter(array &$formatter) {
  $formatter['application/json'] = function ($result, $server) {
    return drupal_json_encode($result);
  };
}