You are here

function _node_resource_retrieve in Services 7.3

Same name and namespace in other branches
  1. 6.3 resources/node_resource.inc \_node_resource_retrieve()
  2. 6.2 services/node_service/node_resource.inc \_node_resource_retrieve()
  3. 7 services/node_service/node_resource.inc \_node_resource_retrieve()

Returns the results of a node_load() for the specified node.

This returned node may optionally take content_permissions settings into account, based on a configuration setting.

Parameters

$nid: NID of the node we want to return.

Return value

Node object or FALSE if not found.

See also

node_load()

3 string references to '_node_resource_retrieve'
hook_services_resources in docs/services.services.api.php
Defines function signatures for resources available to services.
ServicesRESTServerTests::getTestResource in servers/rest_server/tests/ServicesRESTServerTests.test
_node_resource_definition in resources/node_resource.inc

File

resources/node_resource.inc, line 265

Code

function _node_resource_retrieve($nid) {
  $node = node_load($nid);
  if ($node) {
    $uri = entity_uri('node', $node);
    $node->path = url($uri['path'], array(
      'absolute' => TRUE,
    ));

    // Unset uri as it has complete entity and this
    // cause never ending recursion in rendering.
    unset($node->uri);
  }

  //Lets check field_permissions
  $node = services_field_permissions_clean('view', 'node', $node);
  return $node;
}