You are here

function page_manager_node_add in Chaos Tool Suite (ctools) 6

Same name and namespace in other branches
  1. 7 page_manager/plugins/tasks/node_edit.inc \page_manager_node_add()

Callback to handle the process of adding a node.

This creates a basic $node and passes that off to page_manager_node_edit(). It is modeled after Drupal's node_add() function.

Unlike node_add() we do not need to check node_access because that was already checked by the menu system.

1 string reference to 'page_manager_node_add'
page_manager_node_edit_menu_alter in page_manager/plugins/tasks/node_edit.inc
Callback defined by page_manager_node_edit_page_manager_tasks().

File

page_manager/plugins/tasks/node_edit.inc, line 115

Code

function page_manager_node_add($type) {
  global $user;
  $types = node_get_types();

  // Initialize settings:
  $node = (object) array(
    'uid' => $user->uid,
    'name' => isset($user->name) ? $user->name : '',
    'type' => $type,
    'language' => '',
  );
  drupal_set_title(t('Create @name', array(
    '@name' => $types[$type]->name,
  )));
  return page_manager_node_edit($node);
}