Elin Waring recently blogged on the Joomla! Community Portal about some of the features coming with Joomla! 1.7, appropriately titled Peeking at 1.7. Aside from the separation of the framework and CMS, I think (and I may be a bit biased) one of the better changes is the ability to batch process items being added to the framework. A popular feature excluded from Joomla! 1.6, its return for 1.7 marks benefit for users and developers alike.
BACK STORY
Getting batch processing into the core for 1.6 and 1.7 hasn't been an easy task. At the first beta release of 1.6, only the Menu Manager had it in the items view. After one tracker item, the methods were carried over to the Category Manager. The place that it was most asked for, the Joomla! Templates Video-Training Article Manager, just couldn't get the same treatment in a timely manner and it was decided that this feature wasn't important enough to block the release of 1.6. Fast forward a few months, and Dennis Hermatski submitted a patch to batch process articles. It was tested and implemented into the development head, which was moving away from the 1.6 series and beginning to take shape for the forthcoming 1.7 release. Upon seeing this commit, I remembered the lack of batch processing being available for the core and began testing Dennis' code on other core components. I realized that Dennis had not only coded a solution for the Article Manager, but the code was easily reusable throughout the CMS.
INTO THE FRAMEWORK
I quickly requested an SVN branch to begin incorporating this feature into the framework to make it Joomla! 1.5 Essential Training available for the core components and all third party developers. The first task was to move the code out of ContentControllerArticle and ContentModelArticle into the methods that they had overridden, JControllerForm and JModelAdmin (respectively). The model functions were a simple move which required only changing hard coded com_content references into an $extension variable that would act based on which component was using the code at the time. The controller method took a little bit of outside thinking because each controller sets a redirect for after the process is complete. Instead of each controller duplicating all the batch function code, I decided instead to move the common code into JControllerForm with each controller presetting the actionable model and the redirect before feeding into the parent function.
Once all the code was moved, I began reviewing the existing code for com_categories and com_menus to determine how much of this extended code could be deleted. I found several lines that were deletable, including making the controller methods follow my boilerplate code. As a further demonstration of the implementation, batch processing was added to com_weblinks as well. more at Joomla