I've updated the example module to use the hook_form_alter() instead of hook_nodeapi().

Comments?

Comments

drewish’s picture

StatusFileSize
new9.92 KB

crap, wrong patch. i'll try it again.

Bèr Kessels’s picture

Am I tired, or did you atatch the wrong patch?

Bèr Kessels’s picture

heh :) Iam tired and you commited the wrong patch :)

drewish’s picture

hehe, i was just about to write back "both" ;)

chx’s picture

Status: Active » Needs work

type is not set always in the form -- form_alter is called for all forms.

drewish’s picture

chx, i thought the comment made it clear that it was only set on forms that dealt with nodes... or are you saying that i'll throw warning/notices because that value isn't set?

chx’s picture

yes you will see core form_alters for more

drewish’s picture

chx, I'm sorry I don't understand what your saying. What exactly is the problem with the given code and what should be changed?

chx’s picture

open menu.module and check menu_form_alter

drewish’s picture

StatusFileSize
new10.62 KB

i took chx's cryptic hint and added a test to see if $form['type'] is set. comments?

zach harkey’s picture

+1?

See, I don't know if this works or not. Trying to learn, a task made far more difficult when official documentation that is presented as current is out-of-date.

zach harkey’s picture

Seems to work now.

drewish’s picture

Status: Needs work » Fixed

ah, yeah, i'd updated the docs but forgot to close the issue.

Anonymous’s picture

Status: Fixed » Closed (fixed)