1 | <?php |
---|
2 | |
---|
3 | /** |
---|
4 | * @file |
---|
5 | * Contains the highcharts style plugin. |
---|
6 | */ |
---|
7 | |
---|
8 | /** |
---|
9 | * Style plugin uses views ui to configure views data for rendering highcharts. |
---|
10 | * |
---|
11 | * @ingroup views_style_plugins |
---|
12 | */ |
---|
13 | class views_semantic_style_plugin extends views_plugin_style { |
---|
14 | function init(&$view, &$display, $options = NULL) { |
---|
15 | parent::init($view, $display, $options); |
---|
16 | } |
---|
17 | |
---|
18 | // Set default options |
---|
19 | function option_definition() { |
---|
20 | $options = parent::option_definition(); |
---|
21 | $options['nid'] = array('default' => ''); |
---|
22 | $options['data'] = array('default' => ''); |
---|
23 | $options['extra'] = array('default' => ''); |
---|
24 | return $options; |
---|
25 | } |
---|
26 | |
---|
27 | |
---|
28 | function options_form(&$form, &$form_state) { |
---|
29 | parent::options_form($form, $form_state); |
---|
30 | |
---|
31 | // Pre-build all of our option lists for the dials and switches that follow. |
---|
32 | $fields = array('' => t('<none>')); |
---|
33 | foreach ($this->display->handler->get_handlers('field') as $field => $handler) { |
---|
34 | if ($label = $handler->label()) { |
---|
35 | $fields[$field] = $label . ' ' . $handler->options['format']; |
---|
36 | } |
---|
37 | else { |
---|
38 | $fields[$field] = $handler->ui_name(); |
---|
39 | } |
---|
40 | } |
---|
41 | $form['nid'] = array( |
---|
42 | '#type' => 'select', |
---|
43 | '#title' => t('Nid field'), |
---|
44 | '#options' => $fields, |
---|
45 | '#default_value' => $this->options['nid'], |
---|
46 | '#description' => t('Select the field that will be used as the title field.'), |
---|
47 | '#required' => true, |
---|
48 | '#weight' => 0, |
---|
49 | ); |
---|
50 | $form['data'] = array( |
---|
51 | '#type' => 'select', |
---|
52 | '#title' => t('Content field'), |
---|
53 | '#options' => $fields, |
---|
54 | '#default_value' => $this->options['data'], |
---|
55 | '#description' => t('Select the field that will be used as the content.'), |
---|
56 | '#required' => true, |
---|
57 | '#weight' => 1, |
---|
58 | ); |
---|
59 | $form['extra'] = array( |
---|
60 | '#type' => 'select', |
---|
61 | '#title' => t('Extra field'), |
---|
62 | '#options' => $fields, |
---|
63 | '#default_value' => $this->options['extra'], |
---|
64 | '#description' => t('Select the field that will be used as the description.'), |
---|
65 | '#weight' => 2, |
---|
66 | ); |
---|
67 | } |
---|
68 | } |
---|
69 | |
---|