Closed (won't fix)
Project:
Views (for Drupal 7)
Version:
5.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
14 Oct 2006 at 05:31 UTC
Updated:
18 Sep 2008 at 22:46 UTC
I have exposed the category, category_node and category_hiearchy tables to views. I'm trying to create a view of parent categories for a particular container, but running into the problem of sub-categories being included on the list.
I wish to write a filter handler for the category_node.nid field which will basically say this:
Include this node only if the node id is equal to category_node.nid AND category_node.cid
Can someone help me do this? My views module api code for exposing the category_node table is included below. Thanks!
return array(
'category_node' => array(
'name' => 'category_node',
'join' => array(
'left' => array(
'table' => 'node',
'field' => 'nid',
),
'right' => array(
'field' => 'nid',
), // end right array
), // end join array
'fields' => array(
'cid' => array(
'name' => t('Category Node: ID'),
'sortable' => true
), // end cid array
'nid' => array(
'name' => t('Category Node: Node ID'),
'sortable' => true
), // end nid array
), // end fields array
'filters' => array(
'cid' => array(
'name' => t('Category Node: ID'),
'operator' => 'category_handler_operator_eqto',
'handler' => 'category_handler_filter_eqto',
'help' => t('This filter allows categories to be filtered by their IDs.'),
), // end cid array
//
// Right now, I'm just using a straight equal to handler
//
'nid' => array(
'name' => t('Category Node: Node ID'),
'operator' => 'views_handler_operator_eqto',
'handler' => 'category_handler_filter_eqto',
'help' => t('This filter allows categories to be filtered by their node IDs.'),
), // end nid array
), // end filters
), // end category_node array
Comments
Comment #1
somebodysysop commentedOK, this one I figured out:
However, what I really want to do is join the category_node table to the category_hiearchy table in this way:
Let's say that $arg is the value submitted, I want to code my handler to do this:
Can someone show me how this filter is constructed?
Comment #2
jyamada1 commentedI've got a similar issue that I've posted over here: http://drupal.org/node/134680#comment-220645
from the above comment it looks like the $query object used to be passed to filter handlers, but is not any more?
Comment #3
sunSorry, unfortunately this support request is way too specific. Please have a look at the issue queue - Views maintainers are buried already. You might want to try to get further support at http://drupal.org/support.
Comment #4
somebodysysop commentedSupport requested nearly 2 years ago. I guess better late than never, eh?