Performance gain in looping over forms

robertDouglass - July 25, 2009 - 13:13
Project:Popups: Add and Reference
Version:6.x-2.0-alpha1
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:active
Description

I think you can speed up your form altering by pre-filtering:

foreach ($form as $key => $item) {
becomes
foreach (element_children($form) as $key => $item) {
This has the advantage of skipping all the elements that start with #

 
 

Drupal is a registered trademark of Dries Buytaert.