Projet

Général

Profil

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

root / drupal7 / sites / all / modules / views / plugins / views_plugin_style_list.inc @ 7547bb19

1
<?php
2

    
3
/**
4
 * @file
5
 * Contains the list style plugin.
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
   * Set default options
16
   */
17
  function option_definition() {
18
    $options = parent::option_definition();
19

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

    
24
    return $options;
25
  }
26

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