function nodehierarchy_views_update in Node Hierarchy 7.2
Same name and namespace in other branches
- 5 nodehierarchy_views/nodehierarchy_views.module \nodehierarchy_views_update()
- 6.3 nodehierarchy_views/nodehierarchy_views.module \nodehierarchy_views_update()
- 6 nodehierarchy_views/nodehierarchy_views.module \nodehierarchy_views_update()
- 6.2 nodehierarchy_views/nodehierarchy_views.module \nodehierarchy_views_update()
- 7.4 nodehierarchy_views/nodehierarchy_views.module \nodehierarchy_views_update()
Update the given embedded view.
2 calls to nodehierarchy_views_update()
- nodehierarchy_views_insert in nodehierarchy_views/
nodehierarchy_views.module - Insert the given embedded view.
- nodehierarchy_views_node_update in nodehierarchy_views/
nodehierarchy_views.module - Implements hook_node_update().
File
- nodehierarchy_views/
nodehierarchy_views.module, line 187 - Embed a view of children onto a node.
Code
function nodehierarchy_views_update($node) {
if (user_access('edit embedded child view')) {
db_delete('nodehierarchy_views')
->condition('nid', $node->nid)
->execute();
if (@$node->nh_children_view) {
list($view, $display) = explode(':', $node->nh_children_view);
// If this update is not from a form submit then the display may be stored separately.
if (empty($display)) {
$display = !empty($node->nh_children_view_display) ? $node->nh_children_view_display : 'default';
}
$id = db_insert('nodehierarchy_views')
->fields(array(
'nid' => $node->nid,
'nh_children_view' => $view,
'nh_children_view_display' => $display,
))
->execute();
}
}
}