Fwd: Re: [development] #just_before_validation ?

Bèr Kessels ber at webschuur.com
Sun May 21 12:00:28 UTC 2006


Op zondag 21 mei 2006 13:31, schreef Earl Dunovant:
> In hook_form_alter() try
>
> $form['title']['#type'] = 'value';
> $form['title']['#value'] = 'dummy value';

I do a 
$form['title']['#type'] = 'value';
$form['title']['#value'] = 'THIS_MIGHT_VALIDATE';

But that is neither clean nor secure. what if the hypothetical 
title_must_contain_three_words.module hops in ? 
Nor will the autogenerated title pass by any validation anymore. 

This is the current route a node takes (very rough)
  new/existing node -> POST -> hook_validate -> Store -> hook_insert()
I would love to see, use or have:
  new/existing node -> POST -> *DO STUFF* -> hook_validate -> Store -> 
hook_insert()

As you can see, _insert and nodeapi('insert') is too late anyway. (I need to 
verify, it was like this all along 4.7 to head a few months ago. But even itf 
it hooks in earlier, I cannot use it) 

So let me take a step back, rephrase, and ask my question again: 

I am looking for the following: I want to generate the title of a node from 
content in that node. 
I currently manage to do this, by abusing validation, by adding dummy text in 
hook_form_alter.

I am looking for a SOLID and clean way to achieve this. 

So: Is form api able to help me with this? In some undocumented hook that I 
missed? Or do we simply lack the hooks to do this, and should I continue on 
my hackish and dirty (but working) road?

Bèr

-- 
 [ Bèr Kessels | Drupal services www.webschuur.com ]

CVS onder de knie krijgen:
 http://help.sympal.nl/cvs_onder_de_knie_krijgen
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://lists.drupal.org/pipermail/development/attachments/20060521/75b9a15d/attachment.pgp


More information about the development mailing list