[development] Update 4.7 to 5.0 question

Jeremy Epstein jazepstein at gmail.com
Fri Sep 15 10:56:24 UTC 2006


On 9/15/06, AjK <drupal at f2s.com> wrote:
> http://drupal.org/node/64279#node-type-settings
>
> Question, what's the difference between this
>
>   $node_type = $form['old_type']['#value'];
>
> and this
>
>   $node_type =  $form['identity']['type']['#default_value']
>
> The former is what the upgrade guide says to do, the latter "looks" how it
> really ought to be done and both appear to work (imho there's something just
> not quite right about a variable called "old_type")

The correct way is to use the 'type' property', not the 'old_type'
property. This is how form_alter() callbacks in core (for HEAD) alter
the node type settings form - e.g. see upload_form_alter().

I didn't write the "Changes to node type settings form" stuff
(although I did write the rest of
<http://drupal.org/node/64279#node-type-settings>), so I don't know
what the reason is for using 'old_type' in the example here. Can
someone explain to me why this example uses 'node_type'? If not, then
I will modify this page so that it matches the examples that can be
found in core.

Cheers,
Jaza.


More information about the development mailing list