1
|
<?php
|
2
|
|
3
|
/**
|
4
|
* @file
|
5
|
* Definition of views_handler_field_ctools_dropdown.
|
6
|
*/
|
7
|
|
8
|
/**
|
9
|
* Field handler which displays some amount of links as ctools dropdown button.
|
10
|
*
|
11
|
* @ingroup views_field_handlers
|
12
|
*/
|
13
|
class views_handler_field_ctools_dropdown extends views_handler_field_links {
|
14
|
function option_definition() {
|
15
|
$options = parent::option_definition();
|
16
|
|
17
|
$options['views_admin_css'] = array('default' => TRUE, 'bool' => TRUE);
|
18
|
|
19
|
return $options;
|
20
|
}
|
21
|
|
22
|
function options_form(&$form, &$form_state) {
|
23
|
parent::options_form($form, $form_state);
|
24
|
$form['fields']['#description'] = t('Fields to be included as ctools dropdown button.');
|
25
|
$form['destination']['#description'] = t('Include a "destination" parameter in the link to return the user to the original view upon completing a link action.');
|
26
|
|
27
|
$form['views_admin_css'] = array(
|
28
|
'#type' => 'checkbox',
|
29
|
'#title' => t('Include Views admin CSS'),
|
30
|
'#description' => t("Add additional css to match the style of the Views admin screen."),
|
31
|
'#default_value' => $this->options['views_admin_css'],
|
32
|
);
|
33
|
}
|
34
|
|
35
|
/**
|
36
|
* Render the dropdown button.
|
37
|
*/
|
38
|
function render($values) {
|
39
|
static $added_admin_css;
|
40
|
$links = $this->get_links();
|
41
|
|
42
|
if (!empty($links)) {
|
43
|
if (!empty($this->options['views_admin_css']) && !$added_admin_css) {
|
44
|
views_include('admin');
|
45
|
views_ui_add_admin_css();
|
46
|
$added_admin_css = TRUE;
|
47
|
}
|
48
|
|
49
|
return theme('links__ctools_dropbutton', array('links' => $links, 'attributes' => array('class' => array('links', 'inline'))));
|
50
|
}
|
51
|
else {
|
52
|
return '';
|
53
|
}
|
54
|
}
|
55
|
}
|