These are a relic from the ancient past. form alter is a much more powerful construct to do the same.

Ah yes, validate / insert / update are obsolete too, but according to http://drupal.org/patch/review "No patch can save the world, not even a Drupal core patch." So, first things first.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

chx’s picture

FileSize
38.22 KB

Very wrong patch got uploaded.

chx’s picture

Oh, I changed and fixed a few things related to filter_form while at it.

chx’s picture

I tested story and I think comment, path, menu, taxonomy fieldsets work besides basic functionality.

Jose Reyero’s picture

Hi,

I dont think we should get rid of that form hook.

When using the form_alter hook, all the modules are called in alphabetical order -right?- but I think these othe r modules may need the basic form maybe to alter it later.

So it could be useful that each node module to provide some 'basic form', then other modules can change it later...

Please, let's keep it, as it allows different levels of customization for forms.

chx’s picture

Title: Obliterate hook_form / nodeapi form » Obliterate nodeapi op form
FileSize
25.28 KB

There is reason in what you say. After all, hook_form creates a form and nodeapi form changes it. The latter must go IMO.

eaton’s picture

Wasn't there a big push to eliminate the node_hooks a while back, and move them all into nodeapi? I assume this means that the trend is reversing...

chx’s picture

There is no reverse. I deleted nodeapi op form only because there is a more general mechanism which does the same. I have not mixed node and nodeapi in any way.

Jose Reyero’s picture

Ok, about nodeapi form I agree.

But I still would like some standard way to pass along with the form the object we are building the form upon. I mean not only for this, but for taxonomy, user, menu... forms too. Some standard way for all of them, like an #object attribute in the array, something that is never rendered later.... -- what happens with the

$form['node'] = array('#type' => 'value', '#value' => $node)

when the form is rendered?

And btw, there's some 'form' in taxonomy api too and it all should be handled in an uniform way IMHO.

The main advantage of these old hooks is that you always get the object as a parameter.

However, I have to say I've just got started with the form API yesterday :-) , so I may be wrong...

chx’s picture

$form['node'] is of type value, that's not rendered at all. We can add $form['user'] and something (either $form['object'] or $form['term'] / $form['vocabulary'] depending on op) to taxonomy forms.

chx’s picture

FileSize
25.28 KB
chx’s picture

FileSize
32.65 KB

Oh, HEAD got updated, that's why my patch failed... There we go. This was the simplest reroll ever, bzr is a miracle to work with.

chx’s picture

FileSize
32.66 KB

New, simpler way to pass on $node. It's $form['#node'] now. Works with PHP5 , too.

chx’s picture

FileSize
32.66 KB

path fixed

chx’s picture

FileSize
32.66 KB

and as usual wrong patch uploaded . SIGH.

chx’s picture

FileSize
32.72 KB

OK, I was wrong, did not work with PHP5. But this one should -- and foreshadows the user and taxonomy form objects.

chx’s picture

And why the change from {0} to [0] ? In Derick Rethans' recent notes, http://www.php.net/~derick/meeting-notes.html {} will be deprecated in PHP 5.1.0 with an E_STRICT and removed in PHP 6.

webchick’s picture

FileSize
36.26 KB

Ok chx and I tested the hell out of this patch last night and all seems to be working. There were some problems with PHP 5.0.5, but they no longer appear in the current patch.

I've included a re-roll that keeps up with current HEAD (that darn menu.module keeps changing ;)).

chx’s picture

Status: Needs review » Reviewed & tested by the community
FileSize
32.51 KB

Now form_sort is fixed and we are good to go.

chx’s picture

Status: Reviewed & tested by the community » Needs work

i need to check menu.

chx’s picture

Status: Needs work » Reviewed & tested by the community
FileSize
26.45 KB

Please get this in, we can hardly keep up with menu :)

chx’s picture

FileSize
26.84 KB

One last menu change...

Dries’s picture

Status: Reviewed & tested by the community » Fixed

Committed to HEAD. Thanks.

drewish’s picture

Not to be a whiner but a bit of a heads up on this would have been nice. Maybe something to the developers mailing list. There are still a few (event and attach that I know of) contrib modules that were using that op and they broke yesterday. I know that chasing HEAD is about as safe as playing in traffic but a notice would have made the troubleshooting a bit quicker.

chx’s picture

Notice sent.

Anonymous’s picture

Status: Fixed » Closed (fixed)