1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495 |
- <?php
- /**
- * @file
- * Describes core default views
- */
- /**
- * Describes core default views
- *
- * @ingroup tripal_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 Nodes';
- $view->core = 7;
- $view->api_version = '3.0';
- $view->disabled = TRUE; /* 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 Pages';
- $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'] = '10';
- $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'] = 'search/node';
- return $view;
- }
|