function restful_get_restful_handler_for_path in RESTful 7
Helper function to get the restful handler for the selected path.
Parameters
string $path: The path you want to get the handler for. Defaults to the current page.
Return value
\RestfulEntityBase The restful handler or NULL.
3 calls to restful_get_restful_handler_for_path()
- RestfulHookMenuTestCase::testVersionNegotiation in tests/
RestfulHookMenuTestCase.test - Test the version negotiation.
- RestfulManager::outputFormat in includes/
RestfulManager.php - Helper function to get the default output format from the current request.
- restful_delivery in ./
restful.module - Returns data in JSON format.
1 string reference to 'restful_get_restful_handler_for_path'
- RestfulHookMenuTestCase::testVersionNegotiation in tests/
RestfulHookMenuTestCase.test - Test the version negotiation.
File
- ./
restful.module, line 374
Code
function restful_get_restful_handler_for_path($path = NULL) {
$handlers =& drupal_static(__FUNCTION__);
$path = is_null($path) ? $_GET['q'] : $path;
if (isset($handlers[$path])) {
return $handlers[$path];
}
$router_item = \RestfulBase::getMenuItem($path);
// We can only get the information if the current path was processed by
// restful_menu_process_callback.
if ($router_item['page_callback'] != 'restful_menu_process_callback') {
$handlers[$path] = FALSE;
return;
}
list($resource, ) = \RestfulBase::getPageArguments($path);
list($major_version, $minor_version) = \RestfulBase::getVersionFromRequest($path);
$handlers[$path] = restful_get_restful_handler($resource, $major_version, $minor_version);
return $handlers[$path];
}