SUMMARY
The 'upload' table has a 'skip base' attribute in its 'Upload: Node' relationship definition. This attribute is to prevent the relationship (or whatever it's attached to) from showing when only a 'node' table, for example, is linked in the view. Incidentally, this 'skip base' feature could be a handy one: it could probably solve another issue: "All terms" field shouldn't show for "term"-type views.
Unfortnately, this 'skip base' feature doesn't work. Steps to reproduce:
- Start a new view, of type 'node'.
- Make sure the 'upload' module is enabled.
- Click the 'Add relationship' button. You'll see 'Upload: Node' in the list. Bad.
SOLUTION
The function that utilizes this 'skip base' is views_fetch_fields(). It has three bugs, which the attached patch fixes:
- It assumed the 'skip base' slot is in the field, not the definition, level. I changed it to look in both levels. (Sorry for code redundancy: I suspect any other way wouldn't have saved many bytes, if at all.)
- The 'foreach' loop was using a '$base' variable, thereby overwriting the '$base' variable which is the function parameter.
- The skipped table name(s) wasn't actually inspected later. I changed that to a hash lookup.
- (Not required.) In upload.views.inc, I added 'node_revisions' to the 'skip base' list: If the base table is node_revisions, one already has access to everything in a node, so there's no need for this extra node relationship.
| Comment | File | Size | Author |
|---|---|---|---|
| skip_base.diff | 2.34 KB | mooffie |
Comments
Comment #1
merlinofchaos commentedCommitted. Sorry about losing track of this one.
Comment #2
Anonymous (not verified) commentedAutomatically closed -- issue fixed for two weeks with no activity.