Closed (works as designed)
Project:
Views (for Drupal 7)
Version:
6.x-2.2
Component:
node data
Priority:
Normal
Category:
Support request
Assigned:
Reporter:
Created:
30 Jan 2009 at 18:30 UTC
Updated:
3 Jan 2010 at 05:21 UTC
I've setup a parent/child relationship using two separate views for the "ads" node type. They're linked by the node id argument. I'm using the filter (by node type=ads) which works but it still tries to display all other node types in the view. My path is node/%, but since the filter is set for only one node type "ads" this shouldn't be happening, right?
Comments
Comment #1
merlinofchaos commentedIt's hard to say from your description. Please export your view(s).
Comment #2
nevets commentedAn alternative approach is to when defining/editing the Node: nid argument is to set "Validator" to "Node" and limit the type to "ads". You can then chose what action to take if the nid is for content other than type "ads"
Comment #3
uasport commentedI scratched the "ads" view and created "project" with the same setup, its still getting hijacking my other nodes. Thanks nevets, I had your suggestion in place already.
$view = new view;
$view->name = 'Project';
$view->description = 'A single project view';
$view->tag = 'project';
$view->view_php = '';
$view->base_table = 'node';
$view->is_cacheable = FALSE;
$view->api_version = 2;
$view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */
$handler = $view->new_display('default', 'Defaults', 'default');
$handler->override_option('fields', array(
'title' => array(
'label' => 'Project Title',
'link_to_node' => 0,
'exclude' => 1,
'id' => 'title',
'table' => 'node',
'field' => 'title',
'override' => array(
'button' => 'Override',
),
'relationship' => 'none',
),
'tid' => array(
'label' => 'Project Category',
'type' => 'separator',
'separator' => ', ',
'empty' => '',
'link_to_taxonomy' => 1,
'limit' => 1,
'vids' => array(
'2' => 2,
'1' => 0,
),
'exclude' => 0,
'id' => 'tid',
'table' => 'term_node',
'field' => 'tid',
'override' => array(
'button' => 'Override',
),
'relationship' => 'none',
),
'tid_1' => array(
'label' => 'Project Length',
'type' => 'separator',
'separator' => ', ',
'empty' => '',
'link_to_taxonomy' => 1,
'limit' => 1,
'vids' => array(
'1' => 1,
'2' => 0,
),
'exclude' => 0,
'id' => 'tid_1',
'table' => 'term_node',
'field' => 'tid',
'override' => array(
'button' => 'Override',
),
'relationship' => 'none',
),
'field_details_value' => array(
'label' => 'Project Details',
'link_to_node' => 0,
'label_type' => 'widget',
'format' => 'default',
'multiple' => array(
'group' => TRUE,
'multiple_number' => '',
'multiple_from' => '',
'multiple_reversed' => FALSE,
),
'exclude' => 0,
'id' => 'field_details_value',
'table' => 'node_data_field_details',
'field' => 'field_details_value',
'override' => array(
'button' => 'Override',
),
'relationship' => 'none',
),
'field_equipment_value' => array(
'label' => 'Required Equipment and Software',
'link_to_node' => 0,
'label_type' => 'widget',
'format' => 'default',
'multiple' => array(
'group' => TRUE,
'multiple_number' => '',
'multiple_from' => '',
'multiple_reversed' => FALSE,
),
'exclude' => 0,
'id' => 'field_equipment_value',
'table' => 'node_data_field_equipment',
'field' => 'field_equipment_value',
'override' => array(
'button' => 'Override',
),
'relationship' => 'none',
),
'field_hours_value' => array(
'label' => 'Est. Project Hours',
'link_to_node' => 0,
'label_type' => 'widget',
'format' => 'default',
'multiple' => array(
'group' => TRUE,
'multiple_number' => '',
'multiple_from' => '',
'multiple_reversed' => FALSE,
),
'exclude' => 0,
'id' => 'field_hours_value',
'table' => 'node_data_field_hours',
'field' => 'field_hours_value',
'override' => array(
'button' => 'Override',
),
'relationship' => 'none',
),
'field_pay_value' => array(
'label' => 'Pay/Hr or Project Costs',
'link_to_node' => 0,
'label_type' => 'widget',
'format' => 'default',
'multiple' => array(
'group' => TRUE,
'multiple_number' => '',
'multiple_from' => '',
'multiple_reversed' => FALSE,
),
'exclude' => 0,
'id' => 'field_pay_value',
'table' => 'node_data_field_pay',
'field' => 'field_pay_value',
'override' => array(
'button' => 'Override',
),
'relationship' => 'none',
),
'created' => array(
'label' => 'Date Project Posted',
'date_format' => 'small',
'custom_date_format' => '',
'exclude' => 0,
'id' => 'created',
'table' => 'node',
'field' => 'created',
'override' => array(
'button' => 'Override',
),
'relationship' => 'none',
),
'value' => array(
'label' => 'Company',
'exclude' => 0,
'id' => 'value',
'table' => 'profile_values_profile_coname',
'field' => 'value',
'override' => array(
'button' => 'Override',
),
'relationship' => 'none',
),
'value_1' => array(
'label' => 'Company E-mail',
'exclude' => 0,
'id' => 'value_1',
'table' => 'profile_values_profile_email',
'field' => 'value',
'override' => array(
'button' => 'Override',
),
'relationship' => 'none',
),
));
$handler->override_option('arguments', array(
'nid' => array(
'default_action' => 'ignore',
'style_plugin' => 'default_summary',
'style_options' => array(),
'wildcard' => 'all',
'wildcard_substitution' => 'All',
'title' => '%1',
'default_argument_type' => 'fixed',
'default_argument' => '',
'validate_type' => 'node',
'validate_fail' => 'not found',
'break_phrase' => 0,
'not' => 0,
'id' => 'nid',
'table' => 'node',
'field' => 'nid',
'override' => array(
'button' => 'Override',
),
'relationship' => 'none',
'default_options_div_prefix' => '',
'default_argument_user' => 0,
'default_argument_fixed' => '',
'default_argument_php' => '',
'validate_argument_node_type' => array(
'project' => 'project',
'blog' => 0,
'poll' => 0,
'page' => 0,
'story' => 0,
),
'validate_argument_node_access' => 0,
'validate_argument_nid_type' => 'nid',
'validate_argument_vocabulary' => array(
'1' => 0,
'2' => 0,
),
'validate_argument_type' => 'tid',
'validate_argument_php' => '',
),
));
$handler->override_option('filters', array(
'status' => array(
'operator' => '=',
'value' => '1',
'group' => '0',
'exposed' => FALSE,
'expose' => array(
'operator' => FALSE,
'label' => '',
),
'id' => 'status',
'table' => 'node',
'field' => 'status',
'relationship' => 'none',
),
'type' => array(
'operator' => 'in',
'value' => array(
'project' => 'project',
),
'group' => '0',
'exposed' => FALSE,
'expose' => array(
'operator' => FALSE,
'label' => '',
),
'id' => 'type',
'table' => 'node',
'field' => 'type',
'relationship' => 'none',
),
));
$handler->override_option('access', array(
'type' => 'none',
));
$handler->override_option('items_per_page', 1);
$handler = $view->new_display('page', 'Project', 'page_1');
$handler->override_option('path', 'node/%');
$handler->override_option('menu', array(
'type' => 'none',
'title' => '',
'weight' => 0,
'name' => 'navigation',
));
$handler->override_option('tab_options', array(
'type' => 'none',
'title' => '',
'weight' => 0,
));
Comment #4
merlinofchaos commentedI'm sorry, Views cannot be used to take over the node/% page this way. Your expectations that simply filtering the view will cause unrepresented nodes to continue to use the original node view is incorrect.
Comment #5
uasport commentedI think it's implied that filtering by type will allow views to work in this manner. Any ideas how to work around this issue? I'd hate to loose the views I have setup.
Comment #6
merlinofchaos commentedIt is not implied. It is implied that if you filter to nodes of a specific type you won't see nodes of other types, but what is NOT implied is that you will fall back to some other type when an argument requests a type that's not being filtered. Not only is that not implied, there's a massive logical leap of fantasy to even get there. There is no workaround for this; what you want to do simply can't be done with Views.
Comment #7
uasport commentedThanks merlin.
Comment #8
MadOverlord commentedI just posted a possible workaround for this problem -- a view + a custom node template that calls it. Hope this helps!
http://drupal.org/node/672920