You are here

function hook_restws_format_info in RESTful Web Services 7

Same name and namespace in other branches
  1. 7.2 restws.api.php \hook_restws_format_info()

Define restws compatible formats.

This hook is required in order to add new restws formats.

Return value

array An array of information about the module's provided formats. The array contains a sub-array for each format, with the format name as the key. Format names may only contain lowercase alpha-numeric characters and underscores. Possible attributes for each sub-array are:

  • label: The label of the format. Start capitalized.
  • class: The name of the class for the format. The class has to implement the RestWSFormatInterface. Required.
  • mime type: The official internet media type (MIME type) of the format. Required.

Related topics

1 function implements hook_restws_format_info()

Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.

restws_restws_format_info in ./restws.module
Implements hook_restws_format_info().
1 invocation of hook_restws_format_info()
restws_get_format_info in ./restws.module
Returns info about all defined formats.

File

./restws.api.php, line 82
This file contains no working PHP code; it exists to provide additional documentation for doxygen as well as to document hooks in the standard Drupal manner.

Code

function hook_restws_format_info() {
  return array(
    'json' => array(
      'label' => t('JSON'),
      'class' => 'RestWSFormatJSON',
      'mime type' => 'application/json',
    ),
    'xml' => array(
      'label' => t('XML'),
      'class' => 'RestWSFormatXML',
      'mime type' => 'application/xml',
    ),
  );
}