views_plugin_style_list.inc

  1. 3.x plugins/views_plugin_style_list.inc
  2. 2.x plugins/views_plugin_style_list.inc

Contains the list style plugin.

File

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