[development] The Drupal Diet - Making bootstrap faster

Earl Miles merlin at logrus.com
Fri May 4 18:15:12 UTC 2007

Larry Garfield wrote:
> 1) Forms that are used as a page handler, if factored out to separate files, 
> may never be called from drupal_execute().  I do not consider this 
> acceptable.

This doesn't follow. If I put my form in foo.pages.inc and use drupal_get_form 
as the callback, and provide my include so that my foo.pages.inc is loaded when 
that menu is hit, my form will be there. This, of course, isn't true if this 
form is also available in a non-page-context, which can happen, but in that 
case the form should be embedded into the .module anyway.

> 2) Forms may not be factored out into separate files at all.  Everything still 
> works, but then there's a lot of form code hanging around we never use.

Again, see above.

> 3) Forms get a separate loading mechanism from pages.  This way 
> drupal_get_form() and drupal_execute() still function everywhere and we can 
> still factor out forms to separate files where appropriate.  

Since 1 and 2 don't follow, this conclusion is inaccurate.

> I want to emphasize that "where appropriate".  Not all handlers or forms 
> should be split out into separate files.  For instance, I'd argue the most 
> often used page handler is node_view(), and the most often used forms are the 
> login block and search block.  We should *not* split those out into separate 
> files.  They're used often enough that their extra weight on other page loads 

You actually mean node_page(), not node_view() =)

webchick and I had talked about node having two pages files; one that was 
exclusively for node_page. I still think that's a good idea.

More information about the development mailing list