You are here

function oa_clone_node_prepopulate in Open Atrium Clone 7.2

Page callback that builds the Clone page with Panels.

Essentially this is combining page_manager_node_add() with clone_node_prepopulate() such that our customizations to the node edit form via Panels are also on the node clone form.

Parameters

object $original_node: A node object representing the node we are cloning.

boolean $set_title: (Optional) Whether we should set the title or not; TRUE by default.

See also

page_manager_node_add()

clone_node_prepopulate()

2 calls to oa_clone_node_prepopulate()
oa_clone_create_space_page_callback in ./oa_clone.module
Page callback that either returns the normal create page or a clone page.
oa_clone_node_check in ./oa_clone.module
Page callback that prompts the user to confirm the operation.

File

./oa_clone.module, line 128

Code

function oa_clone_node_prepopulate($original_node, $set_title = TRUE) {
  if (isset($original_node->nid)) {
    if (clone_is_permitted($original_node->type)) {

      // Include the file which defines _clone_node_prepare().
      module_load_include('inc', 'clone', 'clone.pages');
      $node = _clone_node_prepare($original_node, TRUE);
      if ($set_title) {
        drupal_set_title($node->title);
      }
      else {
        $node->title = '';
      }

      // Let other modules do special fixing up.
      $context = array(
        'method' => 'prepopulate',
        'original_node' => $original_node,
      );
      drupal_alter('clone_node', $node, $context);

      // Make sure the file defining the node form is loaded.
      $form_state = array();
      $form_state['build_info']['args'] = array(
        $node,
      );
      form_load_include($form_state, 'inc', 'page_manager', 'plugins/tasks/node_edit');
      return page_manager_node_edit($node);
    }
  }
}