You are here

function panelizer_node_insert in Panelizer 7

Same name and namespace in other branches
  1. 6 panelizer.module \panelizer_node_insert()

Implements hook_node_insert().

File

./panelizer.module, line 284
panelize.module

Code

function panelizer_node_insert($node) {
  if (!empty($node->clone_from_original_nid)) {

    // For reasons I don't entirely understand, we need to clear the
    // node_load() cache for this node_load() to return anything in here.
    $original_node = node_load($node->clone_from_original_nid, NULL, TRUE);
    ctools_include('node', 'panelizer');
    $original_panelizer = panelizer_load_node_panelizer($original_node);
    if (!empty($original_panelizer)) {
      $cloned_panelizer = panelizer_clone_node_panelizer($original_panelizer, $node->nid);
      panelizer_save_node_panelizer($cloned_panelizer);
    }
  }
}