Closed (won't fix)
Project:
Views (for Drupal 7)
Version:
4.7.x-1.x-dev
Component:
Documentation
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
11 Nov 2006 at 07:47 UTC
Updated:
10 Jan 2008 at 13:16 UTC
Views may benefit from ability to customize standard structures, much like Forms API allows for forms.
For example, creating and using core Views patches (like my recent one http://drupal.org/node/94184) should not require hacking core and/or waiting on a submitted patch to be reviewed and accepted.
My suggestion is to add hooks to allow modules modify core Views structures, including tables, arguments, etc.
On another note, already existing Views hooks need better documentation.
Comments
Comment #1
dkruglyak commentedI found that the way to get this 'alter' behavior is by creating dummy tables and excluding these tables from appearing in (and breaking) actual SQL by dropping 'join' element and adding 'notafield' => TRUE for every field.
This works, but I wish there was a HOW-TO to save time. We need a doc on using dummy tables for extending views features.
Comment #2
merlinofchaos commentedYes. Unfortunately the Views' API documentation has not been updated in a LONG time, and so many, many features have gone undocumented. I've had so many projects that I just never get back to doing the documentation (again).
Comment #3
dkruglyak commentedI hear you. The more important thing is that the code itself works!
Comment #4
merlinofchaos commentedThere's a bunch of new documentation at http://drupal.org/handbook/modules/views/api -- do you think that sufficiently explains things such that it's more clear that dummy tables can work?
Comment #5
dkruglyak commentedLooks like a good start. I think at this point the devil is in details. Now I am back to working on my views and may report minor issues as they suface. Note this forum post: http://drupal.org/node/105396
Case #1: 'option' for fields is not documented. I copied the code for select form element (from one of core views modules), but when tried to set #multiple it did not work. I could not find the documentation for field options to see if it is supported.
In any case, I think it should be possible to use any supported Form API for options anywhere (fields and filters).
Comment #6
merlinofchaos commented'option' is documented here: http://drupal.org/node/99565
Though it turns out the link is incorrect as I originally had that as all one document. That must be changed.
'option' for fields should work exactly the same as it does for arguments, filters and sort criteria.
Comment #7
moshe weitzman commentedFYI, I proposed a patch that allows modules to alter tables and arguments - http://drupal.org/node/105620
Comment #8
catchI believe this is in Views 2.