You are here

function services_node_load in Services 6

Same name and namespace in other branches
  1. 5 services.module \services_node_load()
  2. 6.2 services.module \services_node_load()
  3. 7 services.module \services_node_load()

Make any changes we might want to make to node.

2 calls to services_node_load()
node_service_get in services/node_service/node_service.inc
Returns a specified node.
taxonomy_service_select_nodes in services/taxonomy_service/taxonomy_service.inc
select_nodes

File

./services.module, line 505
@author Services Dev Team

Code

function services_node_load($node, $fields = array()) {
  if (!isset($node->nid)) {
    return NULL;
  }

  // Apply filters to fields
  $body = $node->body;
  $node->body = new stdClass();
  $node->body_value = $body;
  $node->body = check_markup($body, $node->format, FALSE);

  // Loop through and get only requested fields
  if (count($fields) > 0) {
    foreach ($fields as $field) {
      $val->{$field} = $node->{$field};
    }
  }
  else {
    $val = $node;
  }
  return $val;
}