You are here

protected function ViewsUiCommentViewsWizard::default_display_options in Views (for Drupal 7) 7.3

Most subclasses will need to override this method to provide some fields or a different row plugin.

Overrides ViewsUiBaseViewsWizard::default_display_options

File

plugins/views_wizard/views_ui_comment_views_wizard.class.php, line 73
Definition of ViewsUiCommentViewsWizard.

Class

ViewsUiCommentViewsWizard
Tests creating comment views with the wizard.

Code

protected function default_display_options($form, $form_state) {
  $display_options = parent::default_display_options($form, $form_state);

  // Add permission-based access control.
  $display_options['access']['type'] = 'perm';
  $display_options['access']['perm'] = 'access comments';

  // Add a relationship to nodes.
  $display_options['relationships']['nid']['id'] = 'nid';
  $display_options['relationships']['nid']['table'] = 'comment';
  $display_options['relationships']['nid']['field'] = 'nid';
  $display_options['relationships']['nid']['required'] = 1;

  // Remove the default fields, since we are customizing them here.
  unset($display_options['fields']);

  /* Field: Comment: Title */
  $display_options['fields']['subject']['id'] = 'subject';
  $display_options['fields']['subject']['table'] = 'comment';
  $display_options['fields']['subject']['field'] = 'subject';
  $display_options['fields']['subject']['label'] = '';
  $display_options['fields']['subject']['alter']['alter_text'] = 0;
  $display_options['fields']['subject']['alter']['make_link'] = 0;
  $display_options['fields']['subject']['alter']['absolute'] = 0;
  $display_options['fields']['subject']['alter']['trim'] = 0;
  $display_options['fields']['subject']['alter']['word_boundary'] = 0;
  $display_options['fields']['subject']['alter']['ellipsis'] = 0;
  $display_options['fields']['subject']['alter']['strip_tags'] = 0;
  $display_options['fields']['subject']['alter']['html'] = 0;
  $display_options['fields']['subject']['hide_empty'] = 0;
  $display_options['fields']['subject']['empty_zero'] = 0;
  $display_options['fields']['subject']['link_to_comment'] = 1;
  return $display_options;
}