protected function ViewsLazyLoadTest::getTestView in Views Lazy Load 8
Same name and namespace in other branches
- 7 views_lazy_load.test \ViewsLazyLoadTest::getTestView()
Gets a test view.
Parameters
bool $lazy: TRUE if we want our lazy loading enabled.
bool $initialized: TRUE if we want the view setup otherwise FALSE.
Return value
\view The view object.
1 call to ViewsLazyLoadTest::getTestView()
- ViewsLazyLoadTest::testLazyLoading in ./
views_lazy_load.test - Tests the basics of lazy loading.
File
- ./
views_lazy_load.test, line 85 - Contains ViewsLazyLoadTest
Class
- ViewsLazyLoadTest
- Test the basic lazy loading of views.
Code
protected function getTestView($lazy = FALSE, $initialized = TRUE) {
views_include('view');
$view = new view();
$view->name = 'test_view';
$view->description = '';
$view->tag = 'default';
$view->base_table = 'node';
$view->human_name = 'Test View';
$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'] = 'Test View';
$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'] = '10';
$handler->display->display_options['style_plugin'] = 'default';
$handler->display->display_options['row_plugin'] = 'node';
/* 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;
/* 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';
/* 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(
'page' => 'page',
);
/* Display: Page */
$handler = $view
->new_display('page', 'Page', 'page');
$handler->display->display_options['path'] = 'test-view';
// If we've enabled lazy loading, set the appropriate settings.
if ($lazy) {
$handler->display->display_options['views_lazy_load_enabled'] = 1;
}
// Setup the view object ready to go.
if ($initialized) {
$view
->set_display($handler->display->id);
$view
->init_handlers();
}
return $view;
}