function defaultcontent_get_node in Default Content 7
Same name and namespace in other branches
- 7.2 defaultcontent.module \defaultcontent_get_node()
Helper function to get a node when pass a machine name
TODO: i have to keep a static temp because for some reason node_load returns 0 the second time around
Parameters
$name: A machine name
Return value
object Node object
2 calls to defaultcontent_get_node()
- content_features_export_render in ./
defaultcontent.features.inc - Implements hook_features_export_render().
- defaultcontent_page_view in ./
defaultcontent.module - Load up node
File
- ./
defaultcontent.module, line 250 - Module file for the Default content module which allow export and import of default content in a Drupal site.
Code
function defaultcontent_get_node($name) {
static $temp;
if (is_numeric(defaultcontent_get_default($name))) {
$nid = defaultcontent_get_default($name);
if (!isset($temp[$nid])) {
$temp[$nid] = node_load($nid);
}
return $temp[$nid];
}
}