Index: docs/developer/examples/nodeapi_example.module
===================================================================
RCS file: /cvs/drupal/contributions/docs/developer/examples/nodeapi_example.module,v
retrieving revision 1.4
diff -u -F^f -r1.4 nodeapi_example.module
--- docs/developer/examples/nodeapi_example.module	23 Jul 2006 02:32:53 -0000	1.4
+++ docs/developer/examples/nodeapi_example.module	27 Aug 2006 02:45:47 -0000
@@ -32,8 +32,8 @@
  */
 function nodeapi_example_help($section) {
   switch ($section) {
-    case 'admin/modules#description':
-      // This description is shown in the listing at admin/modules.
+    case 'admin/settings/modules#description':
+      // This description is shown in the listing at admin/settings/modules.
       return t('An example module showing how to extend existing content types.');
   }
 }
@@ -45,14 +45,12 @@ function nodeapi_example_help($section) 
  * changes to two types: a node's content type configuration and edit forms.
  */
 function nodeapi_example_form_alter($form_id, &$form) {
-  // We're only modifying node forms, if the type field isn't set we don't need
-  // to bother.
-  if (!isset($form['type'])) {
-    return;
-  }
-
   // Make a copy of the type to shorten up the code
-  $type =  $form['type']['#value'];
+  if ($form_id == 'node_type_form') {
+    $type = $form['old_type']['#value'];
+  } else {
+    $type = $form['type']['#value'];
+  }
 
   // The rating is enabled on a per node type basis. The variable used to store
   // this information is named named using both the name of this module, to
@@ -65,8 +63,8 @@ function nodeapi_example_form_alter($for
     // types should have our rating field added. This is done by inserting a
     // checkbox in the node's content type configuration page. The variable will
     // be automatically saved by the settings form.
-    case $type .'_node_settings':
-      $form['workflow']['nodeapi_example_'. $type] = array(
+    case 'node_type_form':
+      $form['workflow']['nodeapi_example'] = array(
         '#type' => 'radios',
         '#title' => t('NodeAPI Example Rating'),
         '#default_value' => $enabled,
@@ -146,17 +144,16 @@ function nodeapi_example_nodeapi(&$node,
       break;
 
     // Finally, we need to take care of displaying our rating when the node is
-    // viewed. This operation is called after the node has already been prepared
-    // into HTML and filtered as necessary, so we know we are dealing with an
-    // HTML teaser and body. We will inject our additional information at the front
-    // of the node copy.
+    // viewed. We will inject our additional information at the top of the node copy.
     //
     // Using nodeapi('view') is more appropriate than using a filter here, because
     // filters transform user-supplied content, whereas we are extending it with
     // additional information.
     case 'view':
-      $node->body = theme('nodeapi_example_rating', $node->nodeapi_example_rating) . $node->body;
-      $node->teaser = theme('nodeapi_example_rating', $node->nodeapi_example_rating) . $node->teaser;
+      $node->content['nodeapi_example'] = array(
+        '#value' => theme('nodeapi_example_rating', $node->nodeapi_example_rating),
+        '#weight' => -10,
+      );
       break;
   }
 }
