I have started to create a custom views plugin to sort the fields in view according to the video views(not node views but youtube views) on my video content type.
This is how I've implemented hook_views_data()
:
$data = array();
$data['post_video_views']['table']['group'] = t('PROJECT_NAME');
$data['post_video_views']['table']['join'] = array(
'node' => array(
'left_field' => 'nid',
'field' => 'nid',
),
);
$data['post_video_views']['popular'] = array(
'title' => t('Popular videos'),
'help' => t('Youtube views'),
'field' => array(
'handler' => 'views_handler_field',
),
'sort' => array(
'handler' => 'views_handler_sort',
),
);
This gives me an option to sort ascending and descending and also provides the fields to add. Everything working fine till this step.
Now, I want that this options should only appear when when I have the following filter criteria satisfied: Content: Type (= Video)
. How can this be done? I know this should be simple to do but just don't know where to do it.
P.S: I am using Views 3 with D 7.22.
views_handler_relationship
which adds an explicit content type condition to the join