There are five programming customizations that I've had to do over and over with Views 2:
- Create custom exposed form filters, via
- Create "Sort By" exposed form fields.
- Create aggregates by adding GROUP BY via
- Create WHERE clauses what support OR via
- Hack up the pager to match client comps
All of these are addressed by Views 3:
Exposed form is now a plugin
I was very happy to see:
class views_plugin_exposed_form extends views_plugin.
The new class for exposed forms can now be extended to provide custom functionality; however, Views 3 exposed forms are so feature rich, I may not ever find the need. One huge benefit is the array of options that are available: Submit buttons, reset button (awesome!), and sort buttons. Even though I will likely still use hook_form_alter(), I love having the option to build more robust exposed filter forms for clients.
If you look at the sort handlers, you'll see a new method:
can_expose(). With this slice of apple pie, the
query() class will ORDER BY using exposed sorts! I've spend countless hours forcing Views 2 to provide this feature, and I am very happy to see this in Views 3.
GROUP BY support
The new query plugin takes advantage of the GROUP BY methods in the Drupal 7 database abstraction layer. No more query_alters to get GROUP BY support! Note that I said query plugin: The views query itself is now a plugin and can be extended! I expect to see several contributed modules scoring big wins by extending this plugin.
AND/OR support in the WHERE clause
Just like above, the Drupal 7 database abstraction layer is insanely powerful, and Views just climbs right on board. The new WHERE Groups functionality enables endless possibilities of AND/OR WHERE clauses.
Pager is now a plugin
I've suffered many hours in overrides of
theme('pager'). I'm glad to say these days are behind me. Not only is the Views 3 pager so feature rich that I'll likely never need to write code, it is now a plugin that can be easily extended. One of my favorite features is the exposed "All items" option, which is something I've hacked into Views 2 theme overrides no less than a dozen times.