Views 3 makes programmers happy
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.
Yes, this is great indeed. I especially love the "Expose items per page" option.
Sat, 03/26/2011 - 17:05
You missed the probably best feature: query is now a plugin so you can use apachesolr/whatever to integrate directly with views.
Sun, 03/27/2011 - 15:05
Thanks for the write up! Wait for the release version of Views3 seems to be never ending. Can you please give me some idea as to how to expose sorts in Views2? Thanks in advance!
Mon, 05/09/2011 - 19:22
It's just not possible without any kind of dirty hack.
If you need this software feel free to test views 3.x. Quite some people already used it, so there are probably much less bugs as in 6.12, which is one year behind views 2.x-dev.
Mon, 03/28/2011 - 09:52
Views 3 looks promising. Thanks.
Mon, 05/09/2011 - 13:14
Excellent stuff - I'm just getting into Drupal right now, and I'm really loving all the stuff available just on a stock install - but this is totally great!
Tue, 11/15/2011 - 01:36
I can just imagine. It is a very popular module for Drupal and them upgrading it with some significant changes is good news to all views 3 users. Although I did read about it have dependency on Chaos tools which can be seen as both good and bad, but overall it is still a great release.
Sat, 03/26/2011 - 15:26