1 | <?php |
---|
2 | /** |
---|
3 | * @file |
---|
4 | * Contains the list style plugin. |
---|
5 | */ |
---|
6 | |
---|
7 | /** |
---|
8 | * Style plugin to render each item in an ordered or unordered list. |
---|
9 | * |
---|
10 | * @ingroup views_style_plugins |
---|
11 | */ |
---|
12 | class views_plugin_style_list extends views_plugin_style { |
---|
13 | /** |
---|
14 | * Set default options |
---|
15 | */ |
---|
16 | function option_definition() { |
---|
17 | $options = parent::option_definition(); |
---|
18 | |
---|
19 | $options['type'] = array('default' => 'ul'); |
---|
20 | $options['class'] = array('default' => ''); |
---|
21 | $options['wrapper_class'] = array('default' => 'item-list'); |
---|
22 | |
---|
23 | return $options; |
---|
24 | } |
---|
25 | |
---|
26 | /** |
---|
27 | * Render the given style. |
---|
28 | */ |
---|
29 | function options_form(&$form, &$form_state) { |
---|
30 | parent::options_form($form, $form_state); |
---|
31 | $form['type'] = array( |
---|
32 | '#type' => 'radios', |
---|
33 | '#title' => t('List type'), |
---|
34 | '#options' => array('ul' => t('Unordered list'), 'ol' => t('Ordered list')), |
---|
35 | '#default_value' => $this->options['type'], |
---|
36 | ); |
---|
37 | $form['wrapper_class'] = array( |
---|
38 | '#title' => t('Wrapper class'), |
---|
39 | '#description' => t('The class to provide on the wrapper, outside the list.'), |
---|
40 | '#type' => 'textfield', |
---|
41 | '#size' => '30', |
---|
42 | '#default_value' => $this->options['wrapper_class'], |
---|
43 | ); |
---|
44 | $form['class'] = array( |
---|
45 | '#title' => t('List class'), |
---|
46 | '#description' => t('The class to provide on the list element itself.'), |
---|
47 | '#type' => 'textfield', |
---|
48 | '#size' => '30', |
---|
49 | '#default_value' => $this->options['class'], |
---|
50 | ); |
---|
51 | } |
---|
52 | } |
---|