• Main Page
  • Related Pages
  • Modules
  • Classes
  • Files
  • File List
  • File Members

plugins/views_wizard/views_ui_comment_views_wizard.class.php

00001 <?php
00002 
00003 class ViewsUiCommentViewsWizard extends ViewsUiBaseViewsWizard {
00004 
00005   protected function row_style_options($type) {
00006     $options = array();
00007     $options['comment'] = t('comments');
00008     $options['fields'] = t('fields');
00009     return $options;
00010   }
00011 
00012   protected function build_form_style(&$form, &$form_state, $type) {
00013     parent::build_form_style($form, $form_state, $type);
00014     $style_form =& $form['displays'][$type]['options']['style'];
00015     // Some style plugins don't support row plugins so stop here if that's the
00016     // case.
00017     if (!isset($style_form['row_plugin']['#default_value'])) {
00018       return;
00019     }
00020     $row_plugin = $style_form['row_plugin']['#default_value'];
00021     switch ($row_plugin) {
00022       case 'comment':
00023         $style_form['row_options']['links'] = array(
00024           '#type' => 'select',
00025           '#title_display' => 'invisible',
00026           '#title' => t('Should links be displayed below each comment'),
00027           '#options' => array(
00028             1 => t('with links (allow users to reply to the comment, etc.)'),
00029             0 => t('without links'),
00030           ),
00031           '#default_value' => 1,
00032         );
00033         break;
00034     }
00035   }
00036 
00037   protected function page_display_options($form, $form_state) {
00038     $display_options = parent::page_display_options($form, $form_state);
00039     $row_plugin = isset($form_state['values']['page']['style']['row_plugin']) ? $form_state['values']['page']['style']['row_plugin'] : NULL;
00040     $row_options = isset($form_state['values']['page']['style']['row_options']) ? $form_state['values']['page']['style']['row_options'] : array();
00041     $this->display_options_row($display_options, $row_plugin, $row_options);
00042     return $display_options;
00043   }
00044 
00045   protected function block_display_options($form, $form_state) {
00046     $display_options = parent::block_display_options($form, $form_state);
00047     $row_plugin = isset($form_state['values']['block']['style']['row_plugin']) ? $form_state['values']['block']['style']['row_plugin'] : NULL;
00048     $row_options = isset($form_state['values']['block']['style']['row_options']) ? $form_state['values']['block']['style']['row_options'] : array();
00049     $this->display_options_row($display_options, $row_plugin, $row_options);
00050     return $display_options;
00051   }
00052 
00056   protected  function display_options_row(&$display_options, $row_plugin, $row_options) {
00057     switch ($row_plugin) {
00058       case 'comment':
00059         $display_options['row_plugin'] = 'comment';
00060         $display_options['row_options']['links'] = !empty($row_options['links']);
00061         break;
00062     }
00063   }
00064 
00065   protected function default_display_options($form, $form_state) {
00066     $display_options = parent::default_display_options($form, $form_state);
00067 
00068     // Add permission-based access control.
00069     $display_options['access']['type'] = 'perm';
00070 
00071     // Add a relationship to nodes.
00072     $display_options['relationships']['nid']['id'] = 'nid';
00073     $display_options['relationships']['nid']['table'] = 'comment';
00074     $display_options['relationships']['nid']['field'] = 'nid';
00075     $display_options['relationships']['nid']['required'] = 1;
00076 
00077     // Remove the default fields, since we are customizing them here.
00078     unset($display_options['fields']);
00079 
00080     /* Field: Comment: Title */
00081     $display_options['fields']['subject']['id'] = 'subject';
00082     $display_options['fields']['subject']['table'] = 'comment';
00083     $display_options['fields']['subject']['field'] = 'subject';
00084     $display_options['fields']['subject']['label'] = '';
00085     $display_options['fields']['subject']['alter']['alter_text'] = 0;
00086     $display_options['fields']['subject']['alter']['make_link'] = 0;
00087     $display_options['fields']['subject']['alter']['absolute'] = 0;
00088     $display_options['fields']['subject']['alter']['trim'] = 0;
00089     $display_options['fields']['subject']['alter']['word_boundary'] = 0;
00090     $display_options['fields']['subject']['alter']['ellipsis'] = 0;
00091     $display_options['fields']['subject']['alter']['strip_tags'] = 0;
00092     $display_options['fields']['subject']['alter']['html'] = 0;
00093     $display_options['fields']['subject']['hide_empty'] = 0;
00094     $display_options['fields']['subject']['empty_zero'] = 0;
00095     $display_options['fields']['subject']['link_to_comment'] = 1;
00096 
00097     return $display_options;
00098   }
00099 }

Generated on Sun Feb 26 2012 12:52:52 for Views by  doxygen 1.7.1