[development] What about the Drupal API ?? (Re: Javascript API introduction

Steven Wittens steven at acko.net
Fri May 25 21:47:42 UTC 2007

> We would have something like:
> /**
>  * Toggle the visibility of a fieldset using smooth animations
>  *
>  * Applicable to all <fieldset> elements.
>  * The class "collapsed" indicates the state of the fieldset where  
> everything
> in the fieldset but the <legend> element is hidden.
>  * e.g.:
>  * <fieldset class=" collapsible collapsed"><legend>Input
> format</legend></fieldset>
>  */
> Drupal.toggleFieldset = function(fieldset) {

You're never supposed to use the collapsible feature with anything  
other than a Form API-generated collapsible fieldset. Just because  
there is a JS/PHP split doesn't mean that that split maps to the API  
as well. The only JS API functions we have are in drupal.js.  
Everything else is specific to one feature and should not be called  
from outside that .js file itself.

The only exception I know of is the various issues with behaviour  
attaching, for which there is in fact a patch in the queue to provide  
a more robust mechanism.

You would never hack together Form API-like arrays and pass them  
directly to functions buried deep inside form.inc would you?

Steven Wittens

More information about the development mailing list