[documentation] [bug] Incorrect code example for node_example_form

fgm drupal-docs at drupal.org
Mon Dec 19 19:59:52 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:   fgm
 Status:       active

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).




fgm



More information about the documentation mailing list