Projet

Général

Profil

Paste
Télécharger (1,42 ko) Statistiques
| Branche: | Révision:

root / drupal7 / sites / all / modules / views / plugins / views_plugin_style_list.inc @ 5d12d676

1
<?php
2

    
3
/**
4
 * @file
5
 * Definition of views_plugin_style_list.
6
 */
7

    
8
/**
9
 * Style plugin to render each item in an ordered or unordered list.
10
 *
11
 * @ingroup views_style_plugins
12
 */
13
class views_plugin_style_list extends views_plugin_style {
14

    
15
  /**
16
   * Set default options.
17
   */
18
  public function option_definition() {
19
    $options = parent::option_definition();
20

    
21
    $options['type'] = array('default' => 'ul');
22
    $options['class'] = array('default' => '');
23
    $options['wrapper_class'] = array('default' => 'item-list');
24

    
25
    return $options;
26
  }
27

    
28
  /**
29
   * Render the given style.
30
   */
31
  public function options_form(&$form, &$form_state) {
32
    parent::options_form($form, $form_state);
33
    $form['type'] = array(
34
      '#type' => 'radios',
35
      '#title' => t('List type'),
36
      '#options' => array('ul' => t('Unordered list'), 'ol' => t('Ordered list')),
37
      '#default_value' => $this->options['type'],
38
    );
39
    $form['wrapper_class'] = array(
40
      '#title' => t('Wrapper class'),
41
      '#description' => t('The class to provide on the wrapper, outside the list.'),
42
      '#type' => 'textfield',
43
      '#size' => '30',
44
      '#default_value' => $this->options['wrapper_class'],
45
    );
46
    $form['class'] = array(
47
      '#title' => t('List class'),
48
      '#description' => t('The class to provide on the list element itself.'),
49
      '#type' => 'textfield',
50
      '#size' => '30',
51
      '#default_value' => $this->options['class'],
52
    );
53
  }
54

    
55
}