You are here

function nodehierarchy_views_insert in Node Hierarchy 6.3

Same name and namespace in other branches
  1. 5 nodehierarchy_views/nodehierarchy_views.module \nodehierarchy_views_insert()
  2. 6 nodehierarchy_views/nodehierarchy_views.module \nodehierarchy_views_insert()
  3. 6.2 nodehierarchy_views/nodehierarchy_views.module \nodehierarchy_views_insert()
  4. 7.4 nodehierarchy_views/nodehierarchy_views.module \nodehierarchy_views_insert()
  5. 7.2 nodehierarchy_views/nodehierarchy_views.module \nodehierarchy_views_insert()

Insert the given embedded view.

1 call to nodehierarchy_views_insert()
nodehierarchy_views_nodeapi in nodehierarchy_views/nodehierarchy_views.module
Implementation of hook_nodeapi().

File

nodehierarchy_views/nodehierarchy_views.module, line 159
Embed a view of children onto a node.

Code

function nodehierarchy_views_insert($node) {

  // If the user has access to edit the view, update as usual.
  if (user_access('edit embedded child view')) {
    nodehierarchy_views_update($node);
  }
  elseif ($children_view = variable_get('nh_view_default_' . $node->type, NULL)) {
    list($view, $display) = explode(':', $children_view);
    db_query("INSERT INTO {nodehierarchy_views} (nid, nh_children_view) VALUES (%d, '%s')", $node->nid, $view, $display);
  }
}