function node_add_page

node_add_page()

Page callback: Displays add content links for available content types.

Redirects to node/add/[type] if only one content type is available.

See also

node_menu()

File

modules/node/node.pages.inc, line 24
Page callbacks for adding, editing, deleting, and revisions management for content.

Code

function node_add_page() {
  $item = menu_get_item();
  $content = system_admin_menu_block($item);
  // Bypass the node/add listing if only one content type is available.
  if (count($content) == 1) {
    $item = array_shift($content);
    drupal_goto($item['href']);
  }
  return theme('node_add_list', array('content' => $content));
}

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/modules!node!node.pages.inc/function/node_add_page/7.x