1
|
<?php
|
2
|
|
3
|
|
4
|
|
5
|
|
6
|
|
7
|
|
8
|
|
9
|
|
10
|
|
11
|
class ViewsUiCommentViewsWizard extends ViewsUiBaseViewsWizard {
|
12
|
|
13
|
protected function row_style_options($type) {
|
14
|
$options = array();
|
15
|
$options['comment'] = t('comments');
|
16
|
$options['fields'] = t('fields');
|
17
|
return $options;
|
18
|
}
|
19
|
|
20
|
protected function build_form_style(&$form, &$form_state, $type) {
|
21
|
parent::build_form_style($form, $form_state, $type);
|
22
|
$style_form =& $form['displays'][$type]['options']['style'];
|
23
|
|
24
|
|
25
|
if (!isset($style_form['row_plugin']['#default_value'])) {
|
26
|
return;
|
27
|
}
|
28
|
$row_plugin = $style_form['row_plugin']['#default_value'];
|
29
|
switch ($row_plugin) {
|
30
|
case 'comment':
|
31
|
$style_form['row_options']['links'] = array(
|
32
|
'#type' => 'select',
|
33
|
'#title_display' => 'invisible',
|
34
|
'#title' => t('Should links be displayed below each comment'),
|
35
|
'#options' => array(
|
36
|
1 => t('with links (allow users to reply to the comment, etc.)'),
|
37
|
0 => t('without links'),
|
38
|
),
|
39
|
'#default_value' => 1,
|
40
|
);
|
41
|
break;
|
42
|
}
|
43
|
}
|
44
|
|
45
|
protected function page_display_options($form, $form_state) {
|
46
|
$display_options = parent::page_display_options($form, $form_state);
|
47
|
$row_plugin = isset($form_state['values']['page']['style']['row_plugin']) ? $form_state['values']['page']['style']['row_plugin'] : NULL;
|
48
|
$row_options = isset($form_state['values']['page']['style']['row_options']) ? $form_state['values']['page']['style']['row_options'] : array();
|
49
|
$this->display_options_row($display_options, $row_plugin, $row_options);
|
50
|
return $display_options;
|
51
|
}
|
52
|
|
53
|
protected function block_display_options($form, $form_state) {
|
54
|
$display_options = parent::block_display_options($form, $form_state);
|
55
|
$row_plugin = isset($form_state['values']['block']['style']['row_plugin']) ? $form_state['values']['block']['style']['row_plugin'] : NULL;
|
56
|
$row_options = isset($form_state['values']['block']['style']['row_options']) ? $form_state['values']['block']['style']['row_options'] : array();
|
57
|
$this->display_options_row($display_options, $row_plugin, $row_options);
|
58
|
return $display_options;
|
59
|
}
|
60
|
|
61
|
|
62
|
|
63
|
|
64
|
protected function display_options_row(&$display_options, $row_plugin, $row_options) {
|
65
|
switch ($row_plugin) {
|
66
|
case 'comment':
|
67
|
$display_options['row_plugin'] = 'comment';
|
68
|
$display_options['row_options']['links'] = !empty($row_options['links']);
|
69
|
break;
|
70
|
}
|
71
|
}
|
72
|
|
73
|
protected function default_display_options($form, $form_state) {
|
74
|
$display_options = parent::default_display_options($form, $form_state);
|
75
|
|
76
|
|
77
|
$display_options['access']['type'] = 'perm';
|
78
|
$display_options['access']['perm'] = 'access comments';
|
79
|
|
80
|
|
81
|
$display_options['relationships']['nid']['id'] = 'nid';
|
82
|
$display_options['relationships']['nid']['table'] = 'comment';
|
83
|
$display_options['relationships']['nid']['field'] = 'nid';
|
84
|
$display_options['relationships']['nid']['required'] = 1;
|
85
|
|
86
|
|
87
|
unset($display_options['fields']);
|
88
|
|
89
|
|
90
|
$display_options['fields']['subject']['id'] = 'subject';
|
91
|
$display_options['fields']['subject']['table'] = 'comment';
|
92
|
$display_options['fields']['subject']['field'] = 'subject';
|
93
|
$display_options['fields']['subject']['label'] = '';
|
94
|
$display_options['fields']['subject']['alter']['alter_text'] = 0;
|
95
|
$display_options['fields']['subject']['alter']['make_link'] = 0;
|
96
|
$display_options['fields']['subject']['alter']['absolute'] = 0;
|
97
|
$display_options['fields']['subject']['alter']['trim'] = 0;
|
98
|
$display_options['fields']['subject']['alter']['word_boundary'] = 0;
|
99
|
$display_options['fields']['subject']['alter']['ellipsis'] = 0;
|
100
|
$display_options['fields']['subject']['alter']['strip_tags'] = 0;
|
101
|
$display_options['fields']['subject']['alter']['html'] = 0;
|
102
|
$display_options['fields']['subject']['hide_empty'] = 0;
|
103
|
$display_options['fields']['subject']['empty_zero'] = 0;
|
104
|
$display_options['fields']['subject']['link_to_comment'] = 1;
|
105
|
|
106
|
return $display_options;
|
107
|
}
|
108
|
}
|