function themekey_book_get_simple_book_property in ThemeKey 6.2
Same name and namespace in other branches
- 6.4 modules/themekey.book.inc \themekey_book_get_simple_book_property()
- 6.3 modules/themekey.book.inc \themekey_book_get_simple_book_property()
- 7.3 modules/themekey.book.inc \themekey_book_get_simple_book_property()
- 7 modules/themekey.book.inc \themekey_book_get_simple_book_property()
- 7.2 modules/themekey.book.inc \themekey_book_get_simple_book_property()
Helper function that loads a book and returns the value of a book's property.
Parameters
$nid: a node id
$property: name of a nodes attribute as string
Return value
the value of the property or NULL
2 calls to themekey_book_get_simple_book_property()
- themekey_book_nid2bid in modules/
themekey.book.inc - ThemeKey mapping function to set a ThemeKey property's value (destination) with the aid of another ThemeKey property (source).
- themekey_book_nid2has_children in modules/
themekey.book.inc - ThemeKey mapping function to set a ThemeKey property's value (destination) with the aid of another ThemeKey property (source).
File
- modules/
themekey.book.inc, line 96 - Provides some comment attributes as ThemeKey properties.
Code
function themekey_book_get_simple_book_property($nid, $property) {
static $books = array();
if (!isset($books[$nid])) {
$node = new stdClass();
$node->nid = $nid;
// node_load() must not be called from hook_init().
// Therefor we have to execute SQL here using book's hook_nodeapi().
$info = book_nodeapi($node, 'load', NULL, NULL);
if (!empty($info['book'])) {
$books[$nid] = $info['book'];
}
}
if (isset($books[$nid][$property])) {
return $books[$nid][$property];
}
else {
return NULL;
}
}