You are here

protected function FileEntityViewsFieldLinkUsageHandlerTest::getTestView in File Entity (fieldable files) 7.3

Same name and namespace in other branches
  1. 7.2 file_entity_views.test \FileEntityViewsFieldLinkUsageHandlerTest::getTestView()

Creates a test view containing a file usage field.

1 call to FileEntityViewsFieldLinkUsageHandlerTest::getTestView()
FileEntityViewsFieldLinkUsageHandlerTest::testViewsUsageField in ./file_entity_views.test
Test views file usage handlers.

File

./file_entity_views.test, line 68
Definition of FileEntityViewsFieldLinkUsageHandlerTest.

Class

FileEntityViewsFieldLinkUsageHandlerTest
Tests for file_entity views file usage handlers.

Code

protected function getTestView() {
  $view = new view();
  $view->name = 'file_list';
  $view->description = '';
  $view->tag = 'default';
  $view->base_table = 'file_managed';
  $view->human_name = 'File List';
  $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'] = 'File List';
  $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'] = 'none';
  $handler->display->display_options['style_plugin'] = 'default';
  $handler->display->display_options['row_plugin'] = 'fields';

  /* Field: File: Name */
  $handler->display->display_options['fields']['filename']['id'] = 'filename';
  $handler->display->display_options['fields']['filename']['table'] = 'file_managed';
  $handler->display->display_options['fields']['filename']['field'] = 'filename';
  $handler->display->display_options['fields']['filename']['label'] = '';
  $handler->display->display_options['fields']['filename']['alter']['word_boundary'] = FALSE;
  $handler->display->display_options['fields']['filename']['alter']['ellipsis'] = FALSE;

  /* Field: File: Usage link */
  $handler->display->display_options['fields']['usage']['id'] = 'usage';
  $handler->display->display_options['fields']['usage']['table'] = 'file_managed';
  $handler->display->display_options['fields']['usage']['field'] = 'usage';
  $handler->display->display_options['fields']['usage']['count_entities_once'] = 1;

  /* Field: File Usage: Use count */
  $handler->display->display_options['fields']['count']['id'] = 'count';
  $handler->display->display_options['fields']['count']['table'] = 'file_usage';
  $handler->display->display_options['fields']['count']['field'] = 'count';

  /* Display: Page */
  $handler = $view
    ->new_display('page', 'Page', 'page');
  $handler->display->display_options['path'] = 'file-list';
  return $view;
}