function services_node_load in Services 6.2
Same name and namespace in other branches
- 5 services.module \services_node_load()
- 6 services.module \services_node_load()
- 7 services.module \services_node_load()
Create an object that contains only the specified node object attributes.
Parameters
object $node: The node to get the attributes from.
array $fields: An array containing the names of the attributes to get.
Return value
object An object with the specified attributes.
5 calls to services_node_load()
- node_service_get in services/
node_service/ node_service.inc - Returns a specified node.
- node_service_view in services/
node_service/ node_service.inc - Returns a specified node.
- search_service_nodes in services/
search_service/ search_service.inc - Return search results for nodes.
- taxonomy_service_select_nodes in services/
taxonomy_service/ taxonomy_service.inc - Services interface to taxonomy_select_nodes().
- views_service_get in services/
views_service/ views_service.inc - Get a view from the database.
File
- ./
services.module, line 816 - Provides a generic but powerful API for exposing web services.
Code
function services_node_load($node, $fields = array()) {
if (!isset($node->nid)) {
return NULL;
}
// Loop through and get only requested fields
if (count($fields) > 0) {
foreach ($fields as $field) {
$val->{$field} = $node->{$field};
}
}
else {
$val = $node;
}
return $val;
}