You are here

function hook_restws_resource_info in RESTful Web Services 7

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

Define restws compatible resources.

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

Return value

array An array of information about the module's provided resources. The array contains a sub-array for each resource, with the resource name as the key. Resource names may only contain lowercase alpha-numeric characters and underscores and should be prefixed with the providing module name. Possible attributes for each sub-array are:

  • label: The label of the resource. Start capitalized.
  • class: The name of the controller class for the resource. The class has to implement the RestWSResourceControllerInterface. Required.

See also

MyModuleBookResourceController

Related topics

1 function implements hook_restws_resource_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_resource_info in ./restws.module
Implements hook_restws_resource_info().
1 invocation of hook_restws_resource_info()
restws_get_resource_info in ./restws.module
Returns info about all defined resources.

File

./restws.api.php, line 40
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_resource_info() {
  return array(
    'mymodule_book' => array(
      'label' => t('Book'),
      'class' => 'MyModuleBookResourceController',
    ),
    'mymodule_status' => array(
      'label' => t('Status'),
      'class' => 'MyModuleStatusResourceController',
    ),
  );
}