[documentation] [bug] Incorrect code example for node_example_form

drewish drupal-docs at drupal.org
Tue Dec 20 19:45:13 UTC 2005


Issue status update for 
http://drupal.org/node/41750
Post a follow up: 
http://drupal.org/project/comments/add/41750

 Project:      Documentation
 Version:      <none>
 Component:    Developer Guide
 Category:     bug reports
 Priority:     normal
 Assigned to:  Anonymous
 Reported by:  fgm
 Updated by:   drewish
 Status:       active

that looks good to me, can I get an Amen before we commit it?




drewish



Previous comments:
------------------------------------------------------------------------

Mon, 19 Dec 2005 19:59:51 +0000 : fgm

The doc for node_example_form at
http://drupaldocs.org/api/head/function/node_example_form contains an
example taken from
contributions/docs/developer/examples/node_example.module which no
longer provides proper display:


The code goes:

<?php
function node_example_form(&$node) {
  $form['title'] = array('#type' => 'textfield', '#title' =>
t('Title'),
// [...]
  return array_merge($form, filter_form($node->format));
}
?>




which causes the Forms API to display the input filter form on its own,
without a visual container (fieldset).


Is should rather be:

<?php
function node_example_form(&$node) {
  $form['title'] = array('#type' => 'textfield', '#title' =>
t('Title'),
// [...]
  $form['format'] = filter_form($node->format);
  return $form;
}
?>




If the doc is generated from code, the change should also be applied to
contributions/docs/developer/examples/node_example.module.


(fix suggested by Morbus).






More information about the documentation mailing list