123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104 |
- <?php
- /**
- * @file
- * Describes core default views
- */
- /**
- * Describes core default views
- *
- * @ingroup tripal_legacy_core
- */
- function tripal_core_views_default_views() {
- $views = array();
- // We only want to make this view available if the Search API module is installed
- // and the "Default Node Index has been enabled.
- if (module_exists('search_api')) {
- $index_enabled = db_query('SELECT enabled FROM search_api_index WHERE machine_name=:name', array(':name' => 'default_node_index'))->fetchField();
- if ($index_enabled) {
- $view = tripal_core_search_default_node_index();
- $views[$view->name] = $view;
- }
- }
- return $views;
- }
- /**
- * Provides a default search view for the Search API "Default Node Index".
- */
- function tripal_core_search_default_node_index() {
- $view = new view();
- $view->name = 'search_api_default_node_search';
- $view->description = 'A default keyword-based search view using the search API "Default node index".';
- $view->tag = 'search';
- $view->base_table = 'search_api_index_default_node_index';
- $view->human_name = 'Search';
- $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'] = 'Search';
- $handler->display->display_options['use_more_always'] = FALSE;
- $handler->display->display_options['access']['type'] = 'none';
- $handler->display->display_options['cache']['type'] = 'none';
- $handler->display->display_options['query']['type'] = 'views_query';
- $handler->display->display_options['exposed_form']['type'] = 'input_required';
- $handler->display->display_options['exposed_form']['options']['submit_button'] = 'Search';
- $handler->display->display_options['exposed_form']['options']['expose_sort_order'] = FALSE;
- $handler->display->display_options['exposed_form']['options']['text_input_required'] = '';
- $handler->display->display_options['exposed_form']['options']['text_input_required_format'] = 'filtered_html';
- $handler->display->display_options['pager']['type'] = 'full';
- $handler->display->display_options['pager']['options']['items_per_page'] = '25';
- $handler->display->display_options['pager']['options']['offset'] = '0';
- $handler->display->display_options['pager']['options']['id'] = '0';
- $handler->display->display_options['pager']['options']['quantity'] = '9';
- $handler->display->display_options['style_plugin'] = 'default';
- $handler->display->display_options['row_plugin'] = 'fields';
- /* Field: Content: Rendered Node */
- $handler->display->display_options['fields']['rendered_entity']['id'] = 'rendered_entity';
- $handler->display->display_options['fields']['rendered_entity']['table'] = 'views_entity_node';
- $handler->display->display_options['fields']['rendered_entity']['field'] = 'rendered_entity';
- $handler->display->display_options['fields']['rendered_entity']['label'] = '';
- $handler->display->display_options['fields']['rendered_entity']['element_label_colon'] = FALSE;
- $handler->display->display_options['fields']['rendered_entity']['link_to_entity'] = 1;
- $handler->display->display_options['fields']['rendered_entity']['display'] = 'view';
- $handler->display->display_options['fields']['rendered_entity']['view_mode'] = 'teaser';
- $handler->display->display_options['fields']['rendered_entity']['bypass_access'] = 0;
- /* Sort criterion: Search: Relevance */
- $handler->display->display_options['sorts']['search_api_relevance']['id'] = 'search_api_relevance';
- $handler->display->display_options['sorts']['search_api_relevance']['table'] = 'search_api_index_default_node_index';
- $handler->display->display_options['sorts']['search_api_relevance']['field'] = 'search_api_relevance';
- $handler->display->display_options['sorts']['search_api_relevance']['order'] = 'DESC';
- /* Filter criterion: Search: Fulltext search */
- $handler->display->display_options['filters']['search_api_views_fulltext']['id'] = 'search_api_views_fulltext';
- $handler->display->display_options['filters']['search_api_views_fulltext']['table'] = 'search_api_index_default_node_index';
- $handler->display->display_options['filters']['search_api_views_fulltext']['field'] = 'search_api_views_fulltext';
- $handler->display->display_options['filters']['search_api_views_fulltext']['operator'] = 'OR';
- $handler->display->display_options['filters']['search_api_views_fulltext']['exposed'] = TRUE;
- $handler->display->display_options['filters']['search_api_views_fulltext']['expose']['operator_id'] = 'search_api_views_fulltext_op';
- $handler->display->display_options['filters']['search_api_views_fulltext']['expose']['label'] = 'Keywords';
- $handler->display->display_options['filters']['search_api_views_fulltext']['expose']['operator'] = 'search_api_views_fulltext_op';
- $handler->display->display_options['filters']['search_api_views_fulltext']['expose']['identifier'] = 'keywords';
- $handler->display->display_options['filters']['search_api_views_fulltext']['expose']['remember_roles'] = array(
- 2 => '2',
- 1 => 0,
- 3 => 0,
- );
- /* Display: Page */
- $handler = $view->new_display('page', 'Page', 'page');
- $handler->display->display_options['path'] = 'chado';
- $handler->display->display_options['menu']['type'] = 'normal';
- $handler->display->display_options['menu']['title'] = 'Search';
- $handler->display->display_options['menu']['description'] = 'General keyword search of all content.';
- $handler->display->display_options['menu']['weight'] = '0';
- $handler->display->display_options['menu']['context'] = 0;
- $handler->display->display_options['menu']['context_only_inline'] = 0;
- return $view;
- }
|