function restful_test_restful_resource_alter in RESTful 7.2
Implements hook_restful_resource_alter().
Decorate an existing resource with other services (e.g. rate limit and render cache).
File
- tests/
modules/ restful_test/ restful_test.module, line 457 - Helper module for testing the RESTful module.
Code
function restful_test_restful_resource_alter(\Drupal\restful\Plugin\resource\ResourceInterface &$resource) {
// Disable the Files Upload resource based on the settings variable.
if ($resource
->getResourceMachineName() == 'files_upload_test') {
variable_get('restful_file_upload', FALSE) ? $resource
->enable() : $resource
->disable();
}
}