Closed (won't fix)
Project:
Drupal core
Version:
7.x-dev
Component:
documentation
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
19 Mar 2006 at 22:01 UTC
Updated:
19 Nov 2008 at 00:13 UTC
The first example in the Forms API Quick Start Guide at
http://drupaldocs.org/api/head/file/contributions/docs/developer/topics/...
includes this line: #default_value' => $edit['foo'],
but according to chx, it is better practice to use #default_value' => 'foo', instead. The suggested patch fixes this example.
As this is one of the very first examples developers on the learning will read about 4.7, it seems important to make sure the code matches best current practices.
| Comment | File | Size | Author |
|---|---|---|---|
| forms_api.html.patch | 1.89 KB | fgm |
Comments
Comment #1
webchickHm. Really? $edit['foo'] and 'foo' are not the same thing. One is saying "The $foo variable that was submitted with the form" the other is saying "Make it literally the word 'foo'."
I'll talk to chx about this next time I see him to see if he can clarify this.
Comment #2
webchickI talked to chx about this the other day... the deal is we need to remove references to obtaining $edit via $_POST['edit'], not change the actual #default_value thing. Unfortunately this is not as simple as just erasing all instances of $_POST['edit']; it requires re-writing some of the text.
Comment #3
anschinsan commentedComment #4
catchfixed yonks ago.