protected function EntityShareServerRestAbstract::getDefaultRequest in Entity Share 7
Default request parameters.
Return value
array The request parameters.
1 call to EntityShareServerRestAbstract::getDefaultRequest()
- EntityShareServerRestAbstract::parseRequest in modules/
entity_share_server/ includes/ entity_share_server.rest.abstract.inc - Parse the request.
File
- modules/
entity_share_server/ includes/ entity_share_server.rest.abstract.inc, line 246 - Class for handling Entity Share Rest Server request.
Class
- EntityShareServerRestAbstract
- Abstract Class to manage the EntityShare Rest server.
Code
protected function getDefaultRequest() {
$menu_item = menu_get_item();
$menu_path = $menu_item['path'];
// Parse the request path to get args passed to entity share rest api.
$short_path = request_path();
$pos = strpos($short_path, $menu_path);
if ($pos !== FALSE) {
$short_path = substr($short_path, $pos + strlen($menu_path));
}
if (substr($short_path, 0, 1) == '/') {
$short_path = substr($short_path, 1);
}
$args = arg(NULL, $short_path);
// Ex: /node/{id} or node.
$request = array(
'type' => $args[0],
'id' => isset($args[1]) ? $args[1] : NULL,
);
return $request;
}