I have an issue setting up a view block to display the comments of a child page on the parent page. I want to display all of the comments within a book. I have two or three child pages and I want to consolidate that information on the parent page.
The way I have it now ALL of the pages of the entire site are displayed. If i add the "book" relationship to a filter criteria everything is filtered and I do not see what I want. Why is this happening?
Here is my view.
$view = new view();
$view->name = 'discovery_comments';
$view->description = '';
$view->tag = 'default';
$view->base_table = 'node';
$view->human_name = 'discovery comments';
$view->core = 7;
$view->api_version = '3.0';
$view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */
/* Display: Master */
$handler = $view->new_display('default', 'Master', 'default');
$handler->display->display_options['title'] = 'discovery comments';
$handler->display->display_options['use_more_always'] = FALSE;
$handler->display->display_options['access']['type'] = 'perm';
$handler->display->display_options['cache']['type'] = 'none';
$handler->display->display_options['query']['type'] = 'views_query';
$handler->display->display_options['exposed_form']['type'] = 'basic';
$handler->display->display_options['pager']['type'] = 'some';
$handler->display->display_options['pager']['options']['items_per_page'] = '20';
$handler->display->display_options['style_plugin'] = 'table';
$handler->display->display_options['style_options']['columns'] = array(
'title' => 'title',
'vid' => 'vid',
);
$handler->display->display_options['style_options']['default'] = '-1';
$handler->display->display_options['style_options']['info'] = array(
'title' => array(
'sortable' => 0,
'default_sort_order' => 'asc',
'align' => '',
'separator' => '',
'empty_column' => 0,
),
'vid' => array(
'sortable' => 0,
'default_sort_order' => 'asc',
'align' => '',
'separator' => '',
'empty_column' => 0,
),
);
/* Relationship: Comment: Comments of the node */
$handler->display->display_options['relationships']['cid']['id'] = 'cid';
$handler->display->display_options['relationships']['cid']['table'] = 'node';
$handler->display->display_options['relationships']['cid']['field'] = 'cid';
/* Relationship: Book: Top level book */
$handler->display->display_options['relationships']['bid']['id'] = 'bid';
$handler->display->display_options['relationships']['bid']['table'] = 'book';
$handler->display->display_options['relationships']['bid']['field'] = 'bid';
/* Field: Content: Title */
$handler->display->display_options['fields']['title']['id'] = 'title';
$handler->display->display_options['fields']['title']['table'] = 'node';
$handler->display->display_options['fields']['title']['field'] = 'title';
$handler->display->display_options['fields']['title']['label'] = '';
$handler->display->display_options['fields']['title']['alter']['word_boundary'] = FALSE;
$handler->display->display_options['fields']['title']['alter']['ellipsis'] = FALSE;
/* Field: Content revision: Vid */
$handler->display->display_options['fields']['vid']['id'] = 'vid';
$handler->display->display_options['fields']['vid']['table'] = 'node_revision';
$handler->display->display_options['fields']['vid']['field'] = 'vid';
$handler->display->display_options['fields']['vid']['label'] = 'idea revision';
/* Field: Comment: Comment */
$handler->display->display_options['fields']['comment_body']['id'] = 'comment_body';
$handler->display->display_options['fields']['comment_body']['table'] = 'field_data_comment_body';
$handler->display->display_options['fields']['comment_body']['field'] = 'comment_body';
$handler->display->display_options['fields']['comment_body']['relationship'] = 'cid';
/* Sort criterion: Content: Post date */
$handler->display->display_options['sorts']['created']['id'] = 'created';
$handler->display->display_options['sorts']['created']['table'] = 'node';
$handler->display->display_options['sorts']['created']['field'] = 'created';
$handler->display->display_options['sorts']['created']['order'] = 'DESC';
/* Contextual filter: Book: Depth */
$handler->display->display_options['arguments']['depth']['id'] = 'depth';
$handler->display->display_options['arguments']['depth']['table'] = 'book_menu_links';
$handler->display->display_options['arguments']['depth']['field'] = 'depth';
$handler->display->display_options['arguments']['depth']['relationship'] = 'bid';
$handler->display->display_options['arguments']['depth']['default_action'] = 'default';
$handler->display->display_options['arguments']['depth']['default_argument_type'] = 'fixed';
$handler->display->display_options['arguments']['depth']['default_argument_options']['argument'] = '2';
$handler->display->display_options['arguments']['depth']['summary']['number_of_records'] = '0';
$handler->display->display_options['arguments']['depth']['summary']['format'] = 'default_summary';
$handler->display->display_options['arguments']['depth']['summary_options']['items_per_page'] = '25';
/* Filter criterion: Content: Published */
$handler->display->display_options['filters']['status']['id'] = 'status';
$handler->display->display_options['filters']['status']['table'] = 'node';
$handler->display->display_options['filters']['status']['field'] = 'status';
$handler->display->display_options['filters']['status']['value'] = 1;
$handler->display->display_options['filters']['status']['group'] = 1;
$handler->display->display_options['filters']['status']['expose']['operator'] = FALSE;
/* Filter criterion: Content: Type */
$handler->display->display_options['filters']['type']['id'] = 'type';
$handler->display->display_options['filters']['type']['table'] = 'node';
$handler->display->display_options['filters']['type']['field'] = 'type';
$handler->display->display_options['filters']['type']['value'] = array(
'mvp_customer_question' => 'mvp_customer_question',
);
/* Display: Block */
$handler = $view->new_display('block', 'Block', 'block');
$handler->display->display_options['defaults']['hide_admin_links'] = FALSE;
$translatables['discovery_comments'] = array(
t('Master'),
t('discovery comments'),
t('more'),
t('Apply'),
t('Reset'),
t('Sort by'),
t('Asc'),
t('Desc'),
t('Comments'),
t('Book'),
t('idea revision'),
t('Comment'),
t('All'),
t('Block'),
);
Comments
Comment #1
dawehner$view->base_table = 'node';
So this is the first problem. You should select to show "comments" on admin/structure/views/add if you want to show comments :)
Regarding the actual problem, I'm not 100% sure how to manage that with just configure a view, but I guess you need custom coding for that. Hierarchy is a complicated problem, see taxonomy.
Comment #2
mustanggb commented