views_plugin_style_list.inc 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. <?php
  2. /**
  3. * @file
  4. * Definition of views_plugin_style_list.
  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. public 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. public 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. }