You are here

function nodehierarchy_views_default_views in Node Hierarchy 5

Same name and namespace in other branches
  1. 6.3 includes/views/nodehierarchy.views_default.inc \nodehierarchy_views_default_views()
  2. 6.2 includes/views/nodehierarchy.views_default.inc \nodehierarchy_views_default_views()
  3. 7.2 includes/views/nodehierarchy.views_default.inc \nodehierarchy_views_default_views()

Useful default views which can be used to display children.

File

nodehierarchy_views/nodehierarchy_views.module, line 348
Views.module integration for nodehierarchy.module.

Code

function nodehierarchy_views_default_views() {
  $view = new stdClass();
  $view->name = 'nodehierarchy_children_teasers';
  $view->description = 'Display a node\'s children as a list';
  $view->access = array();
  $view->view_args_php = '';
  $view->page = TRUE;
  $view->page_title = '';
  $view->page_header = '';
  $view->page_header_format = '1';
  $view->page_footer = '';
  $view->page_footer_format = '1';
  $view->page_empty = '';
  $view->page_empty_format = '1';
  $view->page_type = 'teaser';
  $view->url = '';
  $view->use_pager = FALSE;
  $view->nodes_per_page = '99';
  $view->sort = array(
    array(
      'tablename' => 'nodehierarchy',
      'field' => 'order_by',
      'sortorder' => 'ASC',
      'options' => '',
    ),
  );
  $view->argument = array(
    array(
      'type' => 'parent',
      'argdefault' => '1',
      'title' => '',
      'options' => '',
      'wildcard' => '',
      'wildcard_substitution' => '',
    ),
  );
  $view->field = array(
    array(
      'tablename' => 'node',
      'field' => 'title',
      'label' => '',
      'handler' => 'views_handler_field_nodelink',
      'options' => 'link',
    ),
  );
  $view->filter = array(
    array(
      'tablename' => 'node',
      'field' => 'status',
      'operator' => '=',
      'options' => '',
      'value' => '1',
    ),
  );
  $view->exposed_filter = array();
  $view->requires = array(
    'nodehierarchy',
    'node',
  );
  $views[$view->name] = $view;

  // Duplicate the view.
  $view = unserialize(serialize($view));
  $view->page_type = 'list';
  $view->name = 'nodehierarchy_children_list';
  $view->description = t('Display a node\'s children as a list');
  $views[$view->name] = $view;
  return $views;
}