forms api for files system (was: Re: [development] Files on previews)

Ber Kessels ber at webschuur.com
Sun Nov 13 14:33:33 UTC 2005


On Sat, 12 Nov 2005 14:36:58 -0800
andrew morton <drewish at katherinehouse.com> wrote:

> I'm not any kind of Forms ninja, but I think I've got a reasonable
> understanding of it. Please let me know what I can do to help you with
> it.

In a nutshell: I introduced a fileapi system, nearly a 1-to-1 clone of nodapi, only then for any file object. It reacts on "save", "validate", etc. And it also reacts on "form".

That hook_fileapi($file, 'form', $form) should return a form array, as well as that it passes along the existing form array. In that way modules can alter the form for a file. Anywhere. For example to turn a certain file form into a list of file forms (to allow uploading more then one file at once). Or to change a title or description. Or to remove something from the form. 

I am confident that all this no longer needs a hook, since the formapi has its own "override"  system. I think that one form of type "upload", will suffice. That type should:
* have automatically the javascript/ajax stuff with it.
* be called anywhere a module wants to call it.
* invoke the correct fileapi actions.

Regards, 
  Bèr
-- 
            Bèr Kessels                          Drupal services
            bler.webschuur.com                   www.webschuur.com
            ber at jabber.webschuur.com


More information about the development mailing list