[documentation] [Documentation task] Need review of example_element.module

drewish drupal-docs at drupal.org
Thu Jan 4 06:28:34 UTC 2007


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

 Project:      Documentation
 Version:      <none>
 Component:    Documentation in CVS
 Category:     tasks
 Priority:     normal
 Assigned to:  Anonymous
 Reported by:  drewish
 Updated by:   drewish
-Status:       active
+Status:       fixed

cool, i've added everyone comments and corrections in. i'm going to
assume it's good enough at this point. if people have more additions
feel free to commit them directly.




drewish



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

Wed, 03 Jan 2007 01:34:02 +0000 : drewish

I've added example_element.module [1] to demonstrate how to create a new
form item #type. I'd love some reviews.
[1]
http://cvs.drupal.org/viewcvs/drupal/contributions/docs/developer/exampl...




------------------------------------------------------------------------

Wed, 03 Jan 2007 02:39:50 +0000 : sime

Looks good to me, just need to build up the comments.  If it's of any
use to you, here is an attempt at a nice user-friendly description of
hook_elements.


"Form elements are already familiar to anyone who uses Forms API.
Examples of core form elements are 'textfield', 'checkbox' and
'fieldset'. Drupal utilizes hook_elements() to define these FAPI types,
and this occurs in the core function system_elements().


By implementing hook_elements in your own module, you can create custom
form elements with their own properties, validation and theming."




------------------------------------------------------------------------

Thu, 04 Jan 2007 03:07:30 +0000 : Eaton

"Each form element has a #type value that determines how it's treated by
the Form API and how it's ultimately rendered into HTML. hook_elements()
allows modules to define new element types, and tell the Form API what
default values they should automatically be populated with."




------------------------------------------------------------------------

Thu, 04 Jan 2007 03:11:52 +0000 : dopry

I like it... You could go into more detail in the header php doc about
just what an element is.... a predefined form array with sane defaults
and processing + a theme function. I think thats what I gathered from
IRC talking with eaton.




------------------------------------------------------------------------

Thu, 04 Jan 2007 03:37:16 +0000 : webchick

$element['#value'] = array('areacode'=>'', 'number'=>'',
'extension'=>'');


There needs to be a space between the => and the other stuff.


'#description' => t("Another phone number, a fax perhaps?"),


should be single quotes in the t().


(sorry, those are nit-picky, only because this will be an "example"
module. VERY nice example, btw!)


I'd also throw some more comments in there, to match the other example*
modules. Explain a bit more about hook_elements (just like a two-liner
or so).






More information about the documentation mailing list