From 1687dd07c95a6e14c5438bc3599fa5ff08d661ac Mon Sep 17 00:00:00 2001
From: Dries Buytaert <dries@buytaert.net>
Date: Tue, 27 Jan 2004 18:47:07 +0000
Subject: [PATCH] - Patch 5049 by JonBob: allow a module to define multiple
 node types.

---
 modules/blog.module              | 12 +++----
 modules/blog/blog.module         | 12 +++----
 modules/book.module              | 12 +++----
 modules/book/book.module         | 12 +++----
 modules/forum.module             | 10 +++---
 modules/forum/forum.module       | 10 +++---
 modules/node.module              | 61 +++++++++++++++++---------------
 modules/node/node.module         | 61 +++++++++++++++++---------------
 modules/page.module              | 11 +++---
 modules/page/page.module         | 11 +++---
 modules/poll.module              |  9 ++---
 modules/poll/poll.module         |  9 ++---
 modules/story.module             |  9 ++---
 modules/story/story.module       |  9 ++---
 modules/taxonomy.module          |  6 ++--
 modules/taxonomy/taxonomy.module |  6 ++--
 16 files changed, 130 insertions(+), 130 deletions(-)

diff --git a/modules/blog.module b/modules/blog.module
index 3d4dfd04e79b..9b091b735995 100644
--- a/modules/blog.module
+++ b/modules/blog.module
@@ -8,13 +8,8 @@ function blog_settings() {
   return $output;
 }
 
-function blog_node($field) {
-  global $user;
-
-  $info["name"] = t("personal blog entry");
-  $info["description"] = t("A blog is a regularly updated journal made up of individual entries, often called posts, that are time stamped and typically arranged by the day, with the newest on top (a diary is the reverse).  They tend to be quite personal, often containing links to things you've seen, or to editorials that you find interesting.   Some blogs also contain original material written solely for the blog.  Since a Blog is personal, you and only you have full control over what you publish.  The most interesting blog entries or those blog entries that fit the site's topic well might get promoted to the front page by the community or by users with the access do this.");
-
-  return $info[$field];
+function blog_node_name($node) {
+  return t("personal blog entry");
 }
 
 function blog_perm() {
@@ -85,6 +80,9 @@ function blog_help($section) {
     case 'node/add/blog':
       $output = variable_get('blog_help', '');
       break;
+    case 'node/add#blog':
+      $output = t("A blog is a regularly updated journal made up of individual entries, often called posts, that are time stamped and typically arranged by the day, with the newest on top (a diary is the reverse).  They tend to be quite personal, often containing links to things you've seen, or to editorials that you find interesting.   Some blogs also contain original material written solely for the blog.  Since a Blog is personal, you and only you have full control over what you publish.  The most interesting blog entries or those blog entries that fit the site's topic well might get promoted to the front page by the community or by users with the access do this.");
+      break;
   }
 
   return $output;
diff --git a/modules/blog/blog.module b/modules/blog/blog.module
index 3d4dfd04e79b..9b091b735995 100644
--- a/modules/blog/blog.module
+++ b/modules/blog/blog.module
@@ -8,13 +8,8 @@ function blog_settings() {
   return $output;
 }
 
-function blog_node($field) {
-  global $user;
-
-  $info["name"] = t("personal blog entry");
-  $info["description"] = t("A blog is a regularly updated journal made up of individual entries, often called posts, that are time stamped and typically arranged by the day, with the newest on top (a diary is the reverse).  They tend to be quite personal, often containing links to things you've seen, or to editorials that you find interesting.   Some blogs also contain original material written solely for the blog.  Since a Blog is personal, you and only you have full control over what you publish.  The most interesting blog entries or those blog entries that fit the site's topic well might get promoted to the front page by the community or by users with the access do this.");
-
-  return $info[$field];
+function blog_node_name($node) {
+  return t("personal blog entry");
 }
 
 function blog_perm() {
@@ -85,6 +80,9 @@ function blog_help($section) {
     case 'node/add/blog':
       $output = variable_get('blog_help', '');
       break;
+    case 'node/add#blog':
+      $output = t("A blog is a regularly updated journal made up of individual entries, often called posts, that are time stamped and typically arranged by the day, with the newest on top (a diary is the reverse).  They tend to be quite personal, often containing links to things you've seen, or to editorials that you find interesting.   Some blogs also contain original material written solely for the blog.  Since a Blog is personal, you and only you have full control over what you publish.  The most interesting blog entries or those blog entries that fit the site's topic well might get promoted to the front page by the community or by users with the access do this.");
+      break;
   }
 
   return $output;
diff --git a/modules/book.module b/modules/book.module
index e9b2399042e8..b97c76f5da8a 100644
--- a/modules/book.module
+++ b/modules/book.module
@@ -1,13 +1,8 @@
 <?php
 // $Id$
 
-function book_node($field) {
-  global $user;
-
-  $info["name"] = t("book page");
-  $info["description"] = t("A book is a collaborative writing effort: users can collaborate writing the pages of the book, positioning the pages in the right order, and reviewing or modifying pages previously written.  So when you have some information to share or when you read a page of the book and you didn't like it, or if you think a certain page could have been written better, you can do something about it.");
-
-  return $info[$field];
+function book_node_name($node) {
+  return t("book page");
 }
 
 function book_perm() {
@@ -901,6 +896,9 @@ function book_help($section = "admin/help#book") {
     case 'admin/node/book/orphan':
       $output = t("Pages in a book are like a tree. As pages are edited, reorganized and removed, child pages might be left with no link to the rest of the book.  Such pages are refered to as 'orphan pages'.  On this page, administrators can review their books for orphans and reattach those pages as desired.");
       break;
+    case 'node/add#book':
+      $output = t("A book is a collaborative writing effort: users can collaborate writing the pages of the book, positioning the pages in the right order, and reviewing or modifying pages previously written.  So when you have some information to share or when you read a page of the book and you didn't like it, or if you think a certain page could have been written better, you can do something about it.");
+      break;
   }
 
   return $output;
diff --git a/modules/book/book.module b/modules/book/book.module
index e9b2399042e8..b97c76f5da8a 100644
--- a/modules/book/book.module
+++ b/modules/book/book.module
@@ -1,13 +1,8 @@
 <?php
 // $Id$
 
-function book_node($field) {
-  global $user;
-
-  $info["name"] = t("book page");
-  $info["description"] = t("A book is a collaborative writing effort: users can collaborate writing the pages of the book, positioning the pages in the right order, and reviewing or modifying pages previously written.  So when you have some information to share or when you read a page of the book and you didn't like it, or if you think a certain page could have been written better, you can do something about it.");
-
-  return $info[$field];
+function book_node_name($node) {
+  return t("book page");
 }
 
 function book_perm() {
@@ -901,6 +896,9 @@ function book_help($section = "admin/help#book") {
     case 'admin/node/book/orphan':
       $output = t("Pages in a book are like a tree. As pages are edited, reorganized and removed, child pages might be left with no link to the rest of the book.  Such pages are refered to as 'orphan pages'.  On this page, administrators can review their books for orphans and reattach those pages as desired.");
       break;
+    case 'node/add#book':
+      $output = t("A book is a collaborative writing effort: users can collaborate writing the pages of the book, positioning the pages in the right order, and reviewing or modifying pages previously written.  So when you have some information to share or when you read a page of the book and you didn't like it, or if you think a certain page could have been written better, you can do something about it.");
+      break;
   }
 
   return $output;
diff --git a/modules/forum.module b/modules/forum.module
index 70216a7f083f..4dcbaa0617e9 100644
--- a/modules/forum.module
+++ b/modules/forum.module
@@ -23,16 +23,16 @@ function forum_help($section = "admin/help#forum") {
     case 'node/add/forum':
       $output = variable_get('forum_help', '');
       break;
+    case 'node/add#forum':
+      $output = t("A forum is a threaded discussion, enabling users to communicate about a particular topic.");
+      break;
   }
 
   return $output;
 }
 
-function forum_node($field) {
-  $info["name"] = t("forum topic");
-  $info["description"] = t("A forum is a threaded discussion, enabling users to communicate about a particular topic.");
-
-  return $info[$field];
+function forum_node_name($node) {
+  return t("forum topic");
 }
 
 function forum_access($op, $node) {
diff --git a/modules/forum/forum.module b/modules/forum/forum.module
index 70216a7f083f..4dcbaa0617e9 100644
--- a/modules/forum/forum.module
+++ b/modules/forum/forum.module
@@ -23,16 +23,16 @@ function forum_help($section = "admin/help#forum") {
     case 'node/add/forum':
       $output = variable_get('forum_help', '');
       break;
+    case 'node/add#forum':
+      $output = t("A forum is a threaded discussion, enabling users to communicate about a particular topic.");
+      break;
   }
 
   return $output;
 }
 
-function forum_node($field) {
-  $info["name"] = t("forum topic");
-  $info["description"] = t("A forum is a threaded discussion, enabling users to communicate about a particular topic.");
-
-  return $info[$field];
+function forum_node_name($node) {
+  return t("forum topic");
 }
 
 function forum_access($op, $node) {
diff --git a/modules/node.module b/modules/node.module
index c902fd3b5552..83b559ac477f 100644
--- a/modules/node.module
+++ b/modules/node.module
@@ -32,9 +32,9 @@ function node_help($section = "admin/help#node") {
       <p>Now that you know what is in a node, here are some of the types of nodes available.</p>", array("%teaser" => url("admin/system/modules/node")));
 
       if ($mod == "admin") {
-        foreach (node_list() as $type => $module) {
-          $output .= "<h3>". t("Node type: %module", array("%module" => module_invoke($module, "node", "name", $type))). "</h3>";
-          $output .= module_invoke($module, "node", "description", $type);
+        foreach (node_list() as $type) {
+          $output .= "<h3>". t("Node type: %module", array("%module" => node_invoke($type, "node_name"))). "</h3>";
+          $output .= implode("\n", module_invoke_all("help", "node/add#". $type));
         }
       }
       break;
@@ -227,51 +227,50 @@ function node_teaser($body) {
  */
 function node_get_module_name($node) {
   if (is_array($node)) {
-    if ($pos = strpos($node["type"], ".")) {
+    if ($pos = strpos($node["type"], "/")) {
       return substr($node["type"], 0, $pos);
     } else {
       return $node["type"];
     }
   }
   else if (is_object($node)) {
-    if ($pos = strpos($node->type, ".")) {
+    if ($pos = strpos($node->type, "/")) {
       return substr($node->type, 0, $pos);
     } else {
       return $node->type;
     }
   }
   else if (is_string($node)) {
-    if ($pos = strpos($node, ".")) {
+    if ($pos = strpos($node, "/")) {
       return substr($node, 0, $pos);
     } else {
       return $node;
     }
   }
-} // node_get_module_name
+}
 
 /*
  * Get a list of all the defined node types.
  *
  * @return
- *   An associative list in which the keys are node types and the values
- *   are the names of the modules that define them.
+ *   An list of all node types.
  */
 function node_list() {
   $types = array();
   foreach (module_list() as $module) {
-    if (module_hook($module, "node")) {
-      $module_types = module_invoke($module, "node", "types");
+    if (module_hook($module, "node_name")) {
+      $module_types = module_invoke($module, "node_types");
       if ($module_types) {
         foreach ($module_types as $type) {
-          $types[$type] = $module;
+          $types[] = $type;
         }
       } else {
-        $types[$module] = $module;
+        $types[] = $module;
       }
     }
   }
   return $types;
-} // node_list
+}
 
 /*
  * Determine whether a node hook exists.
@@ -724,7 +723,7 @@ function node_admin_nodes() {
   $header = array(NULL, t("title"), t("type"), t("author"), t("status"), array("data" => t("operations"), "colspan" => 2));
 
   while ($node = db_fetch_object($result)) {
-    $rows[] = array(form_checkbox(NULL, "status][$node->nid", 1, 0), l($node->title, "node/view/$node->nid") ." ". (node_is_new($node->nid, $node->changed) ? theme_mark() : ""), module_invoke(node_get_module_name($node), "node", "name", $node->type), format_name($node), ($node->status ? t("published") : t("not published")), l(t("edit node"), "admin/node/edit/$node->nid"), l(t("delete node"), "admin/node/delete/$node->nid"));
+    $rows[] = array(form_checkbox(NULL, "status][$node->nid", 1, 0), l($node->title, "node/view/$node->nid") ." ". (node_is_new($node->nid, $node->changed) ? theme_mark() : ""), node_invoke($node, "node_name"), format_name($node), ($node->status ? t("published") : t("not published")), l(t("edit node"), "admin/node/edit/$node->nid"), l(t("delete node"), "admin/node/delete/$node->nid"));
   }
 
   if ($pager = theme("pager", NULL, 50, 0)) {
@@ -762,19 +761,19 @@ function node_admin_settings($edit) {
   }
 
   $header = array_merge(array(t("type")), array_keys(node_invoke_nodeapi($node, "settings")));
-  foreach (node_list() as $type => $module) {
+  foreach (node_list() as $type) {
     $node->type = $type;
     $cols = array();
     foreach (node_invoke_nodeapi($node, "settings") as $setting) {
       $cols[] = array("data" => $setting, "align" => "center", "width" => 55);
     }
-    $rows[] = array_merge(array(module_invoke($module, "node", "name", $type)), $cols);
+    $rows[] = array_merge(array(node_invoke($node, "node_name")), $cols);
   }
 
   $output .= theme("table", $header, $rows);
 
   /* This is an idea for the future.
-  foreach (node_list() as $type => $module) {
+  foreach (node_list() as $type) {
     $node->type = $type;
 
       // Create theme("table", ) data:
@@ -784,7 +783,7 @@ function node_admin_settings($edit) {
         $cols[] = array("data" => $setting, "align" => "center", "width" => 75);
       }
 
-      $output .= "<h2>". module_invoke($module, "node", "name", $type) ."</h2>";
+      $output .= "<h2>". node_invoke($node, "node_name") ."</h2>";
       $output .= theme("table", $header, array($cols));
       $output .= "<br /><br />";
     }
@@ -1278,11 +1277,11 @@ function node_add($type) {
     ** Compile a list with the different node types and their explanation:
     */
 
-    foreach (node_list() as $type => $module) {
+    foreach (node_list() as $type) {
       if (node_access("create", $type)) {
         $output .= "<li>";
-        $output .= " ". l(module_invoke($module, "node", "name", $type), "node/add/$type", array("title" => t("Add a new %s.", array("%s" => module_invoke($module, "node", "name", $type)))));
-        $output .= " <div style=\"margin-left: 20px;\">". module_invoke($module, "node", "description", $type) ."</div>";
+        $output .= " ". l(node_invoke($type, "node_name"), "node/add/$type", array("title" => t("Add a new %s.", array("%s" => node_invoke($type, "node_name")))));
+        $output .= " <div style=\"margin-left: 20px;\">". implode("\n", module_invoke_all("help", "node/add#". $type)) ."</div>";
         $output .= "</li>";
       }
     }
@@ -1373,7 +1372,7 @@ function node_preview($node, $error = NULL) {
 
     $output .= node_form($node, $error);
 
-    $name = module_invoke($node->type, "node", "name");
+    $name = node_invoke($node, "node_name");
     drupal_set_breadcrumb(array(l(t("Home"), NULL), l(t("create content"), "node/add"), l(t("Submit %name", array("%name" => $name)), "node/add/$node->type")));
 
     return $output;
@@ -1411,7 +1410,7 @@ function node_submit($node) {
     if (node_access("update", $node)) {
       $node->nid = node_save($node);
       watchdog("special", "$node->type: updated '$node->title'", l(t("view post"), "node/view/$node->nid"));
-      $msg = t("the %name was updated.", array ("%name" => module_invoke(node_get_module_name($node), "node", "name", $node->type)));
+      $msg = t("the %name was updated.", array ("%name" => node_invoke($node, "node_name")));
     }
   }
   else {
@@ -1432,7 +1431,7 @@ function node_submit($node) {
 
       $node->nid = node_save($node);
       watchdog("special", "$node->type: added '$node->title'", l(t("view post"), "node/view/$node->nid"));
-      $msg = t("your %name was created.", array ("%name" => module_invoke($node->type, "node", "name")));
+      $msg = t("your %name was created.", array ("%name" => node_invoke($node, "node_name")));
     }
   }
 
@@ -1486,8 +1485,6 @@ function node_delete($edit) {
 }
 
 function node_page() {
-  global $id, $user, $or, $and;
-
   $op = $_POST["op"];
   $edit = $_POST["edit"];
 
@@ -1505,11 +1502,17 @@ function node_page() {
       $node = node_load(array("nid" => arg(2), "status" => 1), $_GET["revision"]);
     }
 
-    $name = module_invoke(node_get_module_name(arg(2)), "node", "name", arg(2));
+    if ($op == "add" && arg(3)) {
+      $type = arg(2) . "/" . arg(3);
+    }
+    else {
+      $type = arg(2);
+    }
+    $name = node_invoke($type, "node_name");
 
     switch ($op) {
       case "add":
-        print theme("page", node_add(arg(2)), arg(2) ? t("Submit %name", array("%name" => $name)) : t("create content"));
+        print theme("page", node_add($type), arg(2) ? t("Submit %name", array("%name" => $name)) : t("create content"));
         break;
       case "edit":
         print theme("page", node_edit(arg(2)), t("Edit %name", array("%name" => $name)));
diff --git a/modules/node/node.module b/modules/node/node.module
index c902fd3b5552..83b559ac477f 100644
--- a/modules/node/node.module
+++ b/modules/node/node.module
@@ -32,9 +32,9 @@ function node_help($section = "admin/help#node") {
       <p>Now that you know what is in a node, here are some of the types of nodes available.</p>", array("%teaser" => url("admin/system/modules/node")));
 
       if ($mod == "admin") {
-        foreach (node_list() as $type => $module) {
-          $output .= "<h3>". t("Node type: %module", array("%module" => module_invoke($module, "node", "name", $type))). "</h3>";
-          $output .= module_invoke($module, "node", "description", $type);
+        foreach (node_list() as $type) {
+          $output .= "<h3>". t("Node type: %module", array("%module" => node_invoke($type, "node_name"))). "</h3>";
+          $output .= implode("\n", module_invoke_all("help", "node/add#". $type));
         }
       }
       break;
@@ -227,51 +227,50 @@ function node_teaser($body) {
  */
 function node_get_module_name($node) {
   if (is_array($node)) {
-    if ($pos = strpos($node["type"], ".")) {
+    if ($pos = strpos($node["type"], "/")) {
       return substr($node["type"], 0, $pos);
     } else {
       return $node["type"];
     }
   }
   else if (is_object($node)) {
-    if ($pos = strpos($node->type, ".")) {
+    if ($pos = strpos($node->type, "/")) {
       return substr($node->type, 0, $pos);
     } else {
       return $node->type;
     }
   }
   else if (is_string($node)) {
-    if ($pos = strpos($node, ".")) {
+    if ($pos = strpos($node, "/")) {
       return substr($node, 0, $pos);
     } else {
       return $node;
     }
   }
-} // node_get_module_name
+}
 
 /*
  * Get a list of all the defined node types.
  *
  * @return
- *   An associative list in which the keys are node types and the values
- *   are the names of the modules that define them.
+ *   An list of all node types.
  */
 function node_list() {
   $types = array();
   foreach (module_list() as $module) {
-    if (module_hook($module, "node")) {
-      $module_types = module_invoke($module, "node", "types");
+    if (module_hook($module, "node_name")) {
+      $module_types = module_invoke($module, "node_types");
       if ($module_types) {
         foreach ($module_types as $type) {
-          $types[$type] = $module;
+          $types[] = $type;
         }
       } else {
-        $types[$module] = $module;
+        $types[] = $module;
       }
     }
   }
   return $types;
-} // node_list
+}
 
 /*
  * Determine whether a node hook exists.
@@ -724,7 +723,7 @@ function node_admin_nodes() {
   $header = array(NULL, t("title"), t("type"), t("author"), t("status"), array("data" => t("operations"), "colspan" => 2));
 
   while ($node = db_fetch_object($result)) {
-    $rows[] = array(form_checkbox(NULL, "status][$node->nid", 1, 0), l($node->title, "node/view/$node->nid") ." ". (node_is_new($node->nid, $node->changed) ? theme_mark() : ""), module_invoke(node_get_module_name($node), "node", "name", $node->type), format_name($node), ($node->status ? t("published") : t("not published")), l(t("edit node"), "admin/node/edit/$node->nid"), l(t("delete node"), "admin/node/delete/$node->nid"));
+    $rows[] = array(form_checkbox(NULL, "status][$node->nid", 1, 0), l($node->title, "node/view/$node->nid") ." ". (node_is_new($node->nid, $node->changed) ? theme_mark() : ""), node_invoke($node, "node_name"), format_name($node), ($node->status ? t("published") : t("not published")), l(t("edit node"), "admin/node/edit/$node->nid"), l(t("delete node"), "admin/node/delete/$node->nid"));
   }
 
   if ($pager = theme("pager", NULL, 50, 0)) {
@@ -762,19 +761,19 @@ function node_admin_settings($edit) {
   }
 
   $header = array_merge(array(t("type")), array_keys(node_invoke_nodeapi($node, "settings")));
-  foreach (node_list() as $type => $module) {
+  foreach (node_list() as $type) {
     $node->type = $type;
     $cols = array();
     foreach (node_invoke_nodeapi($node, "settings") as $setting) {
       $cols[] = array("data" => $setting, "align" => "center", "width" => 55);
     }
-    $rows[] = array_merge(array(module_invoke($module, "node", "name", $type)), $cols);
+    $rows[] = array_merge(array(node_invoke($node, "node_name")), $cols);
   }
 
   $output .= theme("table", $header, $rows);
 
   /* This is an idea for the future.
-  foreach (node_list() as $type => $module) {
+  foreach (node_list() as $type) {
     $node->type = $type;
 
       // Create theme("table", ) data:
@@ -784,7 +783,7 @@ function node_admin_settings($edit) {
         $cols[] = array("data" => $setting, "align" => "center", "width" => 75);
       }
 
-      $output .= "<h2>". module_invoke($module, "node", "name", $type) ."</h2>";
+      $output .= "<h2>". node_invoke($node, "node_name") ."</h2>";
       $output .= theme("table", $header, array($cols));
       $output .= "<br /><br />";
     }
@@ -1278,11 +1277,11 @@ function node_add($type) {
     ** Compile a list with the different node types and their explanation:
     */
 
-    foreach (node_list() as $type => $module) {
+    foreach (node_list() as $type) {
       if (node_access("create", $type)) {
         $output .= "<li>";
-        $output .= " ". l(module_invoke($module, "node", "name", $type), "node/add/$type", array("title" => t("Add a new %s.", array("%s" => module_invoke($module, "node", "name", $type)))));
-        $output .= " <div style=\"margin-left: 20px;\">". module_invoke($module, "node", "description", $type) ."</div>";
+        $output .= " ". l(node_invoke($type, "node_name"), "node/add/$type", array("title" => t("Add a new %s.", array("%s" => node_invoke($type, "node_name")))));
+        $output .= " <div style=\"margin-left: 20px;\">". implode("\n", module_invoke_all("help", "node/add#". $type)) ."</div>";
         $output .= "</li>";
       }
     }
@@ -1373,7 +1372,7 @@ function node_preview($node, $error = NULL) {
 
     $output .= node_form($node, $error);
 
-    $name = module_invoke($node->type, "node", "name");
+    $name = node_invoke($node, "node_name");
     drupal_set_breadcrumb(array(l(t("Home"), NULL), l(t("create content"), "node/add"), l(t("Submit %name", array("%name" => $name)), "node/add/$node->type")));
 
     return $output;
@@ -1411,7 +1410,7 @@ function node_submit($node) {
     if (node_access("update", $node)) {
       $node->nid = node_save($node);
       watchdog("special", "$node->type: updated '$node->title'", l(t("view post"), "node/view/$node->nid"));
-      $msg = t("the %name was updated.", array ("%name" => module_invoke(node_get_module_name($node), "node", "name", $node->type)));
+      $msg = t("the %name was updated.", array ("%name" => node_invoke($node, "node_name")));
     }
   }
   else {
@@ -1432,7 +1431,7 @@ function node_submit($node) {
 
       $node->nid = node_save($node);
       watchdog("special", "$node->type: added '$node->title'", l(t("view post"), "node/view/$node->nid"));
-      $msg = t("your %name was created.", array ("%name" => module_invoke($node->type, "node", "name")));
+      $msg = t("your %name was created.", array ("%name" => node_invoke($node, "node_name")));
     }
   }
 
@@ -1486,8 +1485,6 @@ function node_delete($edit) {
 }
 
 function node_page() {
-  global $id, $user, $or, $and;
-
   $op = $_POST["op"];
   $edit = $_POST["edit"];
 
@@ -1505,11 +1502,17 @@ function node_page() {
       $node = node_load(array("nid" => arg(2), "status" => 1), $_GET["revision"]);
     }
 
-    $name = module_invoke(node_get_module_name(arg(2)), "node", "name", arg(2));
+    if ($op == "add" && arg(3)) {
+      $type = arg(2) . "/" . arg(3);
+    }
+    else {
+      $type = arg(2);
+    }
+    $name = node_invoke($type, "node_name");
 
     switch ($op) {
       case "add":
-        print theme("page", node_add(arg(2)), arg(2) ? t("Submit %name", array("%name" => $name)) : t("create content"));
+        print theme("page", node_add($type), arg(2) ? t("Submit %name", array("%name" => $name)) : t("create content"));
         break;
       case "edit":
         print theme("page", node_edit(arg(2)), t("Edit %name", array("%name" => $name)));
diff --git a/modules/page.module b/modules/page.module
index 4432601d0438..b45319e8fcf8 100644
--- a/modules/page.module
+++ b/modules/page.module
@@ -13,7 +13,9 @@ function page_help($section = "admin/help#page") {
     case 'admin/system/modules#description':
       $output = t("Enables the creation of a static pages that can be added to the navigation system.");
       break;
-
+    case 'node/add#page':
+      $output = t("If you just want to add a page with a link in the menu to your site, this would be the best choice.  Unlike a story, a static page by-passes the submission queue.");
+      break;
   }
 
   return $output;
@@ -23,11 +25,8 @@ function page_perm() {
   return array("maintain static pages");
 }
 
-function page_node($field) {
-  $info["name"] = t("static page");
-  $info["description"] = t("If you just want to add a page with a link in the menu to your site, this would be the best choice.  Unlike a story, a static page by-passes the submission queue.");
-
-  return $info[$field];
+function page_node_name($node) {
+  return t("static page");
 }
 
 function page_access($op, $node) {
diff --git a/modules/page/page.module b/modules/page/page.module
index 4432601d0438..b45319e8fcf8 100644
--- a/modules/page/page.module
+++ b/modules/page/page.module
@@ -13,7 +13,9 @@ function page_help($section = "admin/help#page") {
     case 'admin/system/modules#description':
       $output = t("Enables the creation of a static pages that can be added to the navigation system.");
       break;
-
+    case 'node/add#page':
+      $output = t("If you just want to add a page with a link in the menu to your site, this would be the best choice.  Unlike a story, a static page by-passes the submission queue.");
+      break;
   }
 
   return $output;
@@ -23,11 +25,8 @@ function page_perm() {
   return array("maintain static pages");
 }
 
-function page_node($field) {
-  $info["name"] = t("static page");
-  $info["description"] = t("If you just want to add a page with a link in the menu to your site, this would be the best choice.  Unlike a story, a static page by-passes the submission queue.");
-
-  return $info[$field];
+function page_node_name($node) {
+  return t("static page");
 }
 
 function page_access($op, $node) {
diff --git a/modules/poll.module b/modules/poll.module
index 5dd9aa1fcbe2..030e8e09d7cc 100644
--- a/modules/poll.module
+++ b/modules/poll.module
@@ -156,6 +156,9 @@ function poll_help($section = "admin/help#poll") {
     case 'admin/system/modules#description':
       $output = t("Enables your site to capture votes on different topics in the form of multiple choice questions.");
       break;
+    case 'node/add#poll':
+      $output = t("A poll is a multiple-choice question which visitors can vote on.");
+      break;
   }
 
   return $output;
@@ -242,10 +245,8 @@ function poll_load($node) {
   return $poll;
 }
 
-function poll_node($field) {
-  $info["name"] = t("poll");
-  $info["description"] = t("A poll is a multiple-choice question which visitors can vote on.");
-  return $info[$field];
+function poll_node_name($node) {
+  return t("poll");
 }
 
 function poll_page() {
diff --git a/modules/poll/poll.module b/modules/poll/poll.module
index 5dd9aa1fcbe2..030e8e09d7cc 100644
--- a/modules/poll/poll.module
+++ b/modules/poll/poll.module
@@ -156,6 +156,9 @@ function poll_help($section = "admin/help#poll") {
     case 'admin/system/modules#description':
       $output = t("Enables your site to capture votes on different topics in the form of multiple choice questions.");
       break;
+    case 'node/add#poll':
+      $output = t("A poll is a multiple-choice question which visitors can vote on.");
+      break;
   }
 
   return $output;
@@ -242,10 +245,8 @@ function poll_load($node) {
   return $poll;
 }
 
-function poll_node($field) {
-  $info["name"] = t("poll");
-  $info["description"] = t("A poll is a multiple-choice question which visitors can vote on.");
-  return $info[$field];
+function poll_node_name($node) {
+  return t("poll");
 }
 
 function poll_page() {
diff --git a/modules/story.module b/modules/story.module
index a66bc6788828..599842fa0880 100644
--- a/modules/story.module
+++ b/modules/story.module
@@ -19,6 +19,9 @@ function story_help($section = "admin/help#story") {
     case 'node/add/story':
       $output = variable_get('story_help', '');
       break;
+    case 'node/add#story':
+      $output = t("A story is a post that is submitted to the attention of other users and is queued in the submission queue.  Users and moderators vote on the posts they like or dislike, promoting or demoting them.  When a post gets above a certain threshold it automatically gets promoted to the front page.");
+      break;
   }
 
   return $output;
@@ -31,10 +34,8 @@ function story_settings() {
  return $output;
 }
 
-function story_node($field) {
-  $info["name"] = t("story");
-  $info["description"] = t("A story is a post that is submitted to the attention of other users and is queued in the submission queue.  Users and moderators vote on the posts they like or dislike, promoting or demoting them.  When a post gets above a certain threshold it automatically gets promoted to the front page.");
-  return $info[$field];
+function story_node_name($node) {
+  return t("story");
 }
 
 function story_perm() {
diff --git a/modules/story/story.module b/modules/story/story.module
index a66bc6788828..599842fa0880 100644
--- a/modules/story/story.module
+++ b/modules/story/story.module
@@ -19,6 +19,9 @@ function story_help($section = "admin/help#story") {
     case 'node/add/story':
       $output = variable_get('story_help', '');
       break;
+    case 'node/add#story':
+      $output = t("A story is a post that is submitted to the attention of other users and is queued in the submission queue.  Users and moderators vote on the posts they like or dislike, promoting or demoting them.  When a post gets above a certain threshold it automatically gets promoted to the front page.");
+      break;
   }
 
   return $output;
@@ -31,10 +34,8 @@ function story_settings() {
  return $output;
 }
 
-function story_node($field) {
-  $info["name"] = t("story");
-  $info["description"] = t("A story is a post that is submitted to the attention of other users and is queued in the submission queue.  Users and moderators vote on the posts they like or dislike, promoting or demoting them.  When a post gets above a certain threshold it automatically gets promoted to the front page.");
-  return $info[$field];
+function story_node_name($node) {
+  return t("story");
 }
 
 function story_perm() {
diff --git a/modules/taxonomy.module b/modules/taxonomy.module
index c7726e039801..0a2c0182792f 100644
--- a/modules/taxonomy.module
+++ b/modules/taxonomy.module
@@ -65,8 +65,8 @@ function taxonomy_link($type, $node = NULL) {
 */
 
 function taxonomy_form_vocabulary($edit = array()) {
-  foreach (node_list() as $type => $module) {
-    $nodetypes[$type] = module_invoke($module, "node", "name", $type);
+  foreach (node_list() as $type) {
+    $nodetypes[$type] = node_invoke($type, "node_name");
   }
 
   $form .= form_textfield(t("Vocabulary name"), "name", $edit["name"], 50, 64, t("Required") .". ". t("The name for this vocabulary.  Example: 'Topic'") .".");
@@ -282,7 +282,7 @@ function taxonomy_overview() {
     $links = array();
     $types = array();
     foreach(explode(",", $vocabulary->nodes) as $type) {
-      $types[] = module_invoke(node_get_module_name($type), "node", "name", $type);
+      $types[] = node_invoke($type, "node_name");
     }
     $rows[] = array($vocabulary->name, array("data" => implode(", ", $types), "align" => "center"), l(t("edit vocabulary"), "admin/taxonomy/edit/vocabulary/$vocabulary->vid"), l(t("add term"), "admin/taxonomy/add/term/$vocabulary->vid"), l(t("preview form"), "admin/taxonomy/preview/vocabulary/$vocabulary->vid"));
 
diff --git a/modules/taxonomy/taxonomy.module b/modules/taxonomy/taxonomy.module
index c7726e039801..0a2c0182792f 100644
--- a/modules/taxonomy/taxonomy.module
+++ b/modules/taxonomy/taxonomy.module
@@ -65,8 +65,8 @@ function taxonomy_link($type, $node = NULL) {
 */
 
 function taxonomy_form_vocabulary($edit = array()) {
-  foreach (node_list() as $type => $module) {
-    $nodetypes[$type] = module_invoke($module, "node", "name", $type);
+  foreach (node_list() as $type) {
+    $nodetypes[$type] = node_invoke($type, "node_name");
   }
 
   $form .= form_textfield(t("Vocabulary name"), "name", $edit["name"], 50, 64, t("Required") .". ". t("The name for this vocabulary.  Example: 'Topic'") .".");
@@ -282,7 +282,7 @@ function taxonomy_overview() {
     $links = array();
     $types = array();
     foreach(explode(",", $vocabulary->nodes) as $type) {
-      $types[] = module_invoke(node_get_module_name($type), "node", "name", $type);
+      $types[] = node_invoke($type, "node_name");
     }
     $rows[] = array($vocabulary->name, array("data" => implode(", ", $types), "align" => "center"), l(t("edit vocabulary"), "admin/taxonomy/edit/vocabulary/$vocabulary->vid"), l(t("add term"), "admin/taxonomy/add/term/$vocabulary->vid"), l(t("preview form"), "admin/taxonomy/preview/vocabulary/$vocabulary->vid"));
 
-- 
GitLab