Hi all, http://drupal.org/node/64279#node-type-settings
From the manual, given when ('node_type_form' == $form_id) :
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") regards, --AjK
On 9/15/06, AjK <drupal@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.
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().
That's true for the most part but not for the conidtion:- ('node_type_form' == $form_id) is TRUE. In that case, $form['type'] isn't set. I believe that's why the upgraders handbook is talking about 'old_type' for some reason. regards, --AjK
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.
participants (2)
-
AjK -
Jeremy Epstein