diff --git a/modules/node/node.pages.inc b/modules/node/node.pages.inc index c6cb1bc..a5ed76f 100644 --- a/modules/node/node.pages.inc +++ b/modules/node/node.pages.inc @@ -23,14 +23,33 @@ function node_page_edit($node) { * @see node_menu() */ 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']); + global $user; + + $types = node_type_get_types(); + foreach ($types as $type) { + if (node_access('create', $type->type)) { + $type_url_str = str_replace('_', '-', $type->type); + $title = t('Add a new @s.', array('@s' => $type->name)); + $out = '' . drupal_ucfirst($type->name) . ''; + $out .= '
' . filter_xss_admin($type->description) . '
'; + $items[$type->name] = l($out, "node/add/$type_url_str", array('title' => $title, 'html' => TRUE)); + } + } + + if (isset($items)) { + uksort($items, 'strnatcasecmp'); + $output = theme('item_list', array('items' => $items, 'attributes' => array('class' => 'admin-list'))); + } + else { + if (user_access('administer content types')) { + $output = '

' . t('You have not created any content types yet. Go to the content type creation page to add a new content type.', array('@create-content' => url('admin/structure/types/add'))) . '

'; + } + else { + $output = '

' . t('No content types available.') . '

'; + } } - return theme('node_add_list', array('content' => $content)); + + return $output; } /** @@ -55,7 +74,12 @@ function theme_node_add_list($variables) { $output .= ''; } else { - $output = '

' . t('You have not created any content types yet. Go to the content type creation page to add a new content type.', array('@create-content' => url('admin/structure/types/add'))) . '

'; + if (user_access('administer content types')) { + $output = '

' . t('You have not created any content types yet. Go to the content type creation page to add a new content type.', array('@create-content' => url('admin/structure/types/add'))) . '

'; + } + else { + $output = '

' . t('No content types available.') . '

'; + } } return $output; }