function themekey_node_get_simple_node_property in ThemeKey 7
Same name and namespace in other branches
- 6.4 modules/themekey.node.inc \themekey_node_get_simple_node_property()
 - 6.2 modules/themekey.node.inc \themekey_node_get_simple_node_property()
 - 6.3 modules/themekey.node.inc \themekey_node_get_simple_node_property()
 - 7.3 modules/themekey.node.inc \themekey_node_get_simple_node_property()
 - 7.2 modules/themekey.node.inc \themekey_node_get_simple_node_property()
 
Helper function that loads a node and returns the value of a node's property.
Parameters
$nid: a node id
$property: name of a node's attribute as string
Return value
the value of the property or NULL
10 calls to themekey_node_get_simple_node_property()
- themekey_node_nid2changed in modules/
themekey.node.inc  - ThemeKey mapping function to set a ThemeKey property's value (destination) with the aid of another ThemeKey property (source).
 - themekey_node_nid2created in modules/
themekey.node.inc  - ThemeKey mapping function to set a ThemeKey property's value (destination) with the aid of another ThemeKey property (source).
 - themekey_node_nid2language in modules/
themekey.node.inc  - ThemeKey mapping function to set a ThemeKey property's value (destination) with the aid of another ThemeKey property (source).
 - themekey_node_nid2promote in modules/
themekey.node.inc  - ThemeKey mapping function to set a ThemeKey property's value (destination) with the aid of another ThemeKey property (source).
 - themekey_node_nid2sticky in modules/
themekey.node.inc  - ThemeKey mapping function to set a ThemeKey property's value (destination) with the aid of another ThemeKey property (source).
 
File
- modules/
themekey.node.inc, line 214  - Provides some node attributes as ThemeKey properties.
 
Code
function themekey_node_get_simple_node_property($nid, $property) {
  static $nodes = array();
  if (!isset($nodes[$nid])) {
    //node_load() must not be called from hook_init(). Therefore, we have to execute SQL here
    $nodes[$nid] = db_select('node', 'n')
      ->fields('n')
      ->condition('n.nid', $nid)
      ->execute()
      ->fetchObject();
  }
  if (isset($nodes[$nid]->{$property})) {
    return $nodes[$nid]->{$property};
  }
  return NULL;
}