answers.views_default.inc in Answers 7.4
Same filename and directory in other branches
Views defaults for the answers module.
File
answers.views_default.incView source
<?php
/**
* @file
* Views defaults for the answers module.
*/
/**
* Implements hook_views_default_views().
*
* Http://api.drupal.org/api/views/views.api.php/function/hook_views_default_views/7
*/
function answers_views_default_views() {
$export = array();
/* Add the questions view */
$view = new view();
_answers_set_questions_view($view);
$export[$view->name] = $view;
/* Add the question_answers view */
$view = new view();
_answers_set_question_answers_view($view);
$export[$view->name] = $view;
return $export;
}
/**
* Return the structure of the questions view.
*/
function _answers_set_questions_view(&$view) {
$view->name = 'questions';
$view->description = '';
$view->tag = 'answers';
$view->base_table = 'node';
$view->human_name = 'Questions';
$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'] = t('!Questions', answers_translation());
$handler->display->display_options['style_options']['sticky'] = 1;
$handler->display->display_options['group_by'] = TRUE;
$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['query']['options']['query_comment'] = FALSE;
$handler->display->display_options['exposed_form']['type'] = 'basic';
$handler->display->display_options['pager']['type'] = 'full';
$handler->display->display_options['pager']['options']['items_per_page'] = '50';
$handler->display->display_options['style_plugin'] = 'table';
$handler->display->display_options['style_options']['columns'] = array(
'changed' => 'changed',
'title' => 'title',
'nid_1' => 'nid_1',
'name' => 'name',
);
$handler->display->display_options['style_options']['default'] = 'changed';
$handler->display->display_options['style_options']['info'] = array(
'changed' => array(
'sortable' => 1,
'default_sort_order' => 'desc',
'align' => '',
'separator' => '',
'empty_column' => 0,
),
'title' => array(
'sortable' => 1,
'default_sort_order' => 'asc',
'align' => '',
'separator' => '',
'empty_column' => 0,
),
'nid_1' => array(
'sortable' => 1,
'default_sort_order' => 'asc',
'align' => 'views-align-center',
'separator' => '',
'empty_column' => 0,
),
'name' => array(
'sortable' => 1,
'default_sort_order' => 'asc',
'align' => '',
'separator' => '',
'empty_column' => 0,
),
);
$handler->display->display_options['style_options']['override'] = TRUE;
$handler->display->display_options['style_options']['sticky'] = TRUE;
/* No results behavior: Global: Text area */
$handler->display->display_options['empty']['area']['id'] = 'area';
$handler->display->display_options['empty']['area']['table'] = 'views';
$handler->display->display_options['empty']['area']['field'] = 'area';
$handler->display->display_options['empty']['area']['label'] = 'No Questions Blurb';
$handler->display->display_options['empty']['area']['empty'] = TRUE;
$handler->display->display_options['empty']['area']['content'] = t('<em>No !questions have been entered yet</em>', answers_translation());
$handler->display->display_options['empty']['area']['format'] = 'filtered_html';
/* Relationship: Entity Reference: Referencing entity */
$handler->display->display_options['relationships']['reverse_answers_related_question_node']['id'] = 'reverse_answers_related_question_node';
$handler->display->display_options['relationships']['reverse_answers_related_question_node']['table'] = 'node';
$handler->display->display_options['relationships']['reverse_answers_related_question_node']['field'] = 'reverse_answers_related_question_node';
$handler->display->display_options['relationships']['reverse_answers_related_question_node']['required'] = 0;
/* Relationship: Content: Author */
$handler->display->display_options['relationships']['uid']['id'] = 'uid';
$handler->display->display_options['relationships']['uid']['table'] = 'node';
$handler->display->display_options['relationships']['uid']['field'] = 'uid';
$handler->display->display_options['relationships']['uid']['required'] = 0;
/* Field: COUNT(Content: Nid) */
$handler->display->display_options['fields']['nid_1']['id'] = 'nid_1';
$handler->display->display_options['fields']['nid_1']['table'] = 'node';
$handler->display->display_options['fields']['nid_1']['field'] = 'nid';
$handler->display->display_options['fields']['nid_1']['relationship'] = 'reverse_answers_related_question_node';
$handler->display->display_options['fields']['nid_1']['group_type'] = 'count';
$handler->display->display_options['fields']['nid_1']['label'] = t('!Answers', answers_translation());
$handler->display->display_options['fields']['nid_1']['alter']['alter_text'] = 0;
$handler->display->display_options['fields']['nid_1']['alter']['make_link'] = 0;
$handler->display->display_options['fields']['nid_1']['alter']['absolute'] = 0;
$handler->display->display_options['fields']['nid_1']['alter']['external'] = 0;
$handler->display->display_options['fields']['nid_1']['alter']['replace_spaces'] = 0;
$handler->display->display_options['fields']['nid_1']['alter']['trim_whitespace'] = 0;
$handler->display->display_options['fields']['nid_1']['alter']['nl2br'] = 0;
$handler->display->display_options['fields']['nid_1']['alter']['word_boundary'] = 1;
$handler->display->display_options['fields']['nid_1']['alter']['ellipsis'] = 1;
$handler->display->display_options['fields']['nid_1']['alter']['more_link'] = 0;
$handler->display->display_options['fields']['nid_1']['alter']['strip_tags'] = 0;
$handler->display->display_options['fields']['nid_1']['alter']['trim'] = 0;
$handler->display->display_options['fields']['nid_1']['alter']['html'] = 0;
$handler->display->display_options['fields']['nid_1']['element_label_colon'] = 0;
$handler->display->display_options['fields']['nid_1']['element_default_classes'] = 1;
$handler->display->display_options['fields']['nid_1']['empty'] = '0';
$handler->display->display_options['fields']['nid_1']['hide_empty'] = 0;
$handler->display->display_options['fields']['nid_1']['empty_zero'] = 1;
$handler->display->display_options['fields']['nid_1']['hide_alter_empty'] = 1;
$handler->display->display_options['fields']['nid_1']['format_plural'] = 0;
/* 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'] = t('!Question', answers_translation());
$handler->display->display_options['fields']['title']['alter']['alter_text'] = 0;
$handler->display->display_options['fields']['title']['alter']['make_link'] = 0;
$handler->display->display_options['fields']['title']['alter']['absolute'] = 0;
$handler->display->display_options['fields']['title']['alter']['external'] = 0;
$handler->display->display_options['fields']['title']['alter']['replace_spaces'] = 0;
$handler->display->display_options['fields']['title']['alter']['trim_whitespace'] = 0;
$handler->display->display_options['fields']['title']['alter']['nl2br'] = 0;
$handler->display->display_options['fields']['title']['alter']['word_boundary'] = 0;
$handler->display->display_options['fields']['title']['alter']['ellipsis'] = 0;
$handler->display->display_options['fields']['title']['alter']['more_link'] = 0;
$handler->display->display_options['fields']['title']['alter']['strip_tags'] = 0;
$handler->display->display_options['fields']['title']['alter']['trim'] = 0;
$handler->display->display_options['fields']['title']['alter']['html'] = 0;
$handler->display->display_options['fields']['title']['element_label_colon'] = 0;
$handler->display->display_options['fields']['title']['element_default_classes'] = 1;
$handler->display->display_options['fields']['title']['hide_empty'] = 0;
$handler->display->display_options['fields']['title']['empty_zero'] = 0;
$handler->display->display_options['fields']['title']['hide_alter_empty'] = 1;
$handler->display->display_options['fields']['title']['link_to_node'] = 1;
/* Field: Content: Updated date */
$handler->display->display_options['fields']['changed']['id'] = 'changed';
$handler->display->display_options['fields']['changed']['table'] = 'node';
$handler->display->display_options['fields']['changed']['field'] = 'changed';
$handler->display->display_options['fields']['changed']['label'] = 'Updated';
$handler->display->display_options['fields']['changed']['alter']['alter_text'] = 0;
$handler->display->display_options['fields']['changed']['alter']['make_link'] = 0;
$handler->display->display_options['fields']['changed']['alter']['absolute'] = 0;
$handler->display->display_options['fields']['changed']['alter']['external'] = 0;
$handler->display->display_options['fields']['changed']['alter']['replace_spaces'] = 0;
$handler->display->display_options['fields']['changed']['alter']['trim_whitespace'] = 0;
$handler->display->display_options['fields']['changed']['alter']['nl2br'] = 0;
$handler->display->display_options['fields']['changed']['alter']['word_boundary'] = 1;
$handler->display->display_options['fields']['changed']['alter']['ellipsis'] = 1;
$handler->display->display_options['fields']['changed']['alter']['more_link'] = 0;
$handler->display->display_options['fields']['changed']['alter']['strip_tags'] = 0;
$handler->display->display_options['fields']['changed']['alter']['trim'] = 0;
$handler->display->display_options['fields']['changed']['alter']['html'] = 0;
$handler->display->display_options['fields']['changed']['element_label_colon'] = 0;
$handler->display->display_options['fields']['changed']['element_default_classes'] = 1;
$handler->display->display_options['fields']['changed']['hide_empty'] = 0;
$handler->display->display_options['fields']['changed']['empty_zero'] = 0;
$handler->display->display_options['fields']['changed']['hide_alter_empty'] = 1;
$handler->display->display_options['fields']['changed']['date_format'] = 'short';
/* Field: User: Name */
$handler->display->display_options['fields']['name']['id'] = 'name';
$handler->display->display_options['fields']['name']['table'] = 'users';
$handler->display->display_options['fields']['name']['field'] = 'name';
$handler->display->display_options['fields']['name']['relationship'] = 'uid';
$handler->display->display_options['fields']['name']['label'] = 'Author';
$handler->display->display_options['fields']['name']['alter']['alter_text'] = 0;
$handler->display->display_options['fields']['name']['alter']['make_link'] = 0;
$handler->display->display_options['fields']['name']['alter']['absolute'] = 0;
$handler->display->display_options['fields']['name']['alter']['external'] = 0;
$handler->display->display_options['fields']['name']['alter']['replace_spaces'] = 0;
$handler->display->display_options['fields']['name']['alter']['trim_whitespace'] = 0;
$handler->display->display_options['fields']['name']['alter']['nl2br'] = 0;
$handler->display->display_options['fields']['name']['alter']['word_boundary'] = 1;
$handler->display->display_options['fields']['name']['alter']['ellipsis'] = 1;
$handler->display->display_options['fields']['name']['alter']['more_link'] = 0;
$handler->display->display_options['fields']['name']['alter']['strip_tags'] = 0;
$handler->display->display_options['fields']['name']['alter']['trim'] = 0;
$handler->display->display_options['fields']['name']['alter']['html'] = 0;
$handler->display->display_options['fields']['name']['element_label_colon'] = 0;
$handler->display->display_options['fields']['name']['element_default_classes'] = 1;
$handler->display->display_options['fields']['name']['hide_empty'] = 0;
$handler->display->display_options['fields']['name']['empty_zero'] = 0;
$handler->display->display_options['fields']['name']['hide_alter_empty'] = 1;
$handler->display->display_options['fields']['name']['link_to_user'] = 1;
$handler->display->display_options['fields']['name']['overwrite_anonymous'] = 0;
$handler->display->display_options['fields']['name']['format_username'] = 1;
/* 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(
'answers_question' => 'answers_question',
);
$handler->display->display_options['filters']['type']['group'] = 1;
/* Display: Page */
$handler = $view
->new_display('page', 'Page', 'page');
$handler->display->display_options['path'] = 'questions';
$handler->display->display_options['menu']['type'] = 'normal';
$handler->display->display_options['menu']['title'] = t('!Questions', answers_translation());
$handler->display->display_options['menu']['weight'] = '1';
$handler->display->display_options['menu']['name'] = 'main-menu';
$handler->display->display_options['menu']['context'] = 0;
/* Display: Own Answers */
$handler = $view
->new_display('page', 'Own Answers', 'page_own_answer');
$handler->display->display_options['defaults']['title'] = FALSE;
$handler->display->display_options['title'] = t('!Answers', answers_translation());
$handler->display->display_options['display_description'] = t('!Questions I have answered.', answers_translation());
$handler->display->display_options['defaults']['arguments'] = FALSE;
/* Contextual filter: Content: Author uid */
$handler->display->display_options['arguments']['uid']['id'] = 'uid';
$handler->display->display_options['arguments']['uid']['table'] = 'node';
$handler->display->display_options['arguments']['uid']['field'] = 'uid';
$handler->display->display_options['arguments']['uid']['relationship'] = 'reverse_answers_related_question_node';
$handler->display->display_options['arguments']['uid']['default_action'] = 'empty';
$handler->display->display_options['arguments']['uid']['default_argument_type'] = 'fixed';
$handler->display->display_options['arguments']['uid']['summary']['number_of_records'] = '0';
$handler->display->display_options['arguments']['uid']['summary']['format'] = 'default_summary';
$handler->display->display_options['arguments']['uid']['summary_options']['items_per_page'] = '25';
$handler->display->display_options['path'] = 'user/%/answers';
$handler->display->display_options['menu']['type'] = 'tab';
$handler->display->display_options['menu']['title'] = t('!Answers', answers_translation());
$handler->display->display_options['menu']['description'] = t('!Questions I have answered.', answers_translation());
$handler->display->display_options['menu']['weight'] = '1';
$handler->display->display_options['menu']['name'] = 'user-menu';
$handler->display->display_options['menu']['context'] = 0;
$handler->display->display_options['menu']['context_only_inline'] = 0;
/* Display: Own Questions */
$handler = $view
->new_display('page', 'Own Questions', 'page_own_question');
$handler->display->display_options['display_description'] = t('!Questions user has asked.', answers_translation());
$handler->display->display_options['defaults']['arguments'] = FALSE;
/* Contextual filter: Content: Author uid */
$handler->display->display_options['arguments']['uid']['id'] = 'uid';
$handler->display->display_options['arguments']['uid']['table'] = 'node';
$handler->display->display_options['arguments']['uid']['field'] = 'uid';
$handler->display->display_options['arguments']['uid']['default_action'] = 'empty';
$handler->display->display_options['arguments']['uid']['default_argument_type'] = 'fixed';
$handler->display->display_options['arguments']['uid']['summary']['number_of_records'] = '0';
$handler->display->display_options['arguments']['uid']['summary']['format'] = 'default_summary';
$handler->display->display_options['arguments']['uid']['summary_options']['items_per_page'] = '25';
$handler->display->display_options['path'] = 'user/%/questions';
$handler->display->display_options['menu']['type'] = 'tab';
$handler->display->display_options['menu']['title'] = t('!Questions', answers_translation());
$handler->display->display_options['menu']['description'] = t('!Questions I have asked.', answers_translation());
$handler->display->display_options['menu']['weight'] = '2';
$handler->display->display_options['menu']['name'] = 'user-menu';
$handler->display->display_options['menu']['context'] = 0;
$handler->display->display_options['menu']['context_only_inline'] = 0;
}
/**
* Return the structure of the question_answers view.
*/
function _answers_set_question_answers_view(&$view) {
$view->name = 'question_answers';
$view->description = t('Provide a list of !answers to a !question', answers_translation());
$view->tag = 'answers';
$view->base_table = 'node';
$view->human_name = 'Answers to a Question';
$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['use_ajax'] = TRUE;
$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['query']['options']['query_comment'] = FALSE;
$handler->display->display_options['exposed_form']['type'] = 'basic';
$handler->display->display_options['pager']['type'] = 'full';
$handler->display->display_options['pager']['options']['items_per_page'] = '10';
$handler->display->display_options['pager']['options']['offset'] = '0';
$handler->display->display_options['pager']['options']['id'] = '40';
$handler->display->display_options['pager']['options']['quantity'] = '9';
$handler->display->display_options['style_plugin'] = 'default';
$handler->display->display_options['row_plugin'] = 'node';
$handler->display->display_options['row_options']['view_mode'] = 'full';
$handler->display->display_options['row_options']['comments'] = TRUE;
/* Header: Global: Answers Count */
$handler->display->display_options['header']['answers_count']['id'] = 'answers_count';
$handler->display->display_options['header']['answers_count']['table'] = 'views';
$handler->display->display_options['header']['answers_count']['field'] = 'answers_count';
/* 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: Content: Related Question (answers_related_question) */
$handler->display->display_options['arguments']['answers_related_question_target_id']['id'] = 'answers_related_question_target_id';
$handler->display->display_options['arguments']['answers_related_question_target_id']['table'] = 'field_data_answers_related_question';
$handler->display->display_options['arguments']['answers_related_question_target_id']['field'] = 'answers_related_question_target_id';
$handler->display->display_options['arguments']['answers_related_question_target_id']['default_action'] = 'not found';
$handler->display->display_options['arguments']['answers_related_question_target_id']['default_argument_type'] = 'fixed';
$handler->display->display_options['arguments']['answers_related_question_target_id']['summary']['number_of_records'] = '0';
$handler->display->display_options['arguments']['answers_related_question_target_id']['summary']['format'] = 'default_summary';
$handler->display->display_options['arguments']['answers_related_question_target_id']['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(
'answers_answer' => 'answers_answer',
);
}
Functions
Name | Description |
---|---|
answers_views_default_views | Implements hook_views_default_views(). |
_answers_set_questions_view | Return the structure of the questions view. |
_answers_set_question_answers_view | Return the structure of the question_answers view. |