You are here

services_views_test.module in Services Views 7

Test module that provides fixtures to test Services Views against.

File

tests/modules/services_views_test/services_views_test.module
View source
<?php

/**
 * @file
 * Test module that provides fixtures to test Services Views against.
 */

/**
 * Implements hook_views_api().
 */
function services_views_test_views_api() {
  return array(
    'api' => 3.0,
    'path' => drupal_get_path('module', 'services_views_test'),
  );
}

/**
 * Implements hook_views_default_views().
 */
function services_views_test_views_default_views() {
  $view = new view();
  $view->name = 'services_views_sorted_nodes';
  $view->description = 'Test View for Services Views';
  $view->tag = 'testing';
  $view->base_table = 'node';
  $view->human_name = 'Services Views Sorted Nodes';
  $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'] = 'Sorted Nodes';
  $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'] = 'full';
  $handler->display->display_options['pager']['options']['items_per_page'] = '5';
  $handler->display->display_options['style_plugin'] = 'default';
  $handler->display->display_options['row_plugin'] = 'fields';

  /* 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;
  $handler->display->display_options['fields']['title']['element_label_colon'] = FALSE;
  $handler->display->display_options['fields']['title']['link_to_node'] = FALSE;

  /* Field: Content: Nid */
  $handler->display->display_options['fields']['nid']['id'] = 'nid';
  $handler->display->display_options['fields']['nid']['table'] = 'node';
  $handler->display->display_options['fields']['nid']['field'] = 'nid';
  $handler->display->display_options['fields']['nid']['label'] = '';
  $handler->display->display_options['fields']['nid']['alter']['word_boundary'] = FALSE;
  $handler->display->display_options['fields']['nid']['alter']['ellipsis'] = FALSE;

  /* Sort criterion: Content: Title */
  $handler->display->display_options['sorts']['title']['id'] = 'title';
  $handler->display->display_options['sorts']['title']['table'] = 'node';
  $handler->display->display_options['sorts']['title']['field'] = 'title';

  /* Display: Page */
  $handler = $view
    ->new_display('page', 'Page', 'page');
  $handler->display->display_options['defaults']['access'] = FALSE;
  $handler->display->display_options['access']['type'] = 'perm';
  $handler->display->display_options['access']['perm'] = 'view own unpublished content';
  $handler->display->display_options['path'] = 'sorted-nodes';

  /* Display: Block */
  $handler = $view
    ->new_display('block', 'Block', 'block_1');
  $handler->display->display_options['block_description'] = 'Sorted Nodes';

  /* Display: Existing Service Display */
  $handler = $view
    ->new_display('services', 'Existing Service Display', 'services_1');
  $handler->display->display_options['path'] = 'existing-service-display';
  $views[$view->name] = $view;
  return $views;
}