list.inc 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. <?php
  2. /**
  3. * @file
  4. * Definition of the 'list' panel style.
  5. */
  6. // Plugin definition
  7. $plugin = array(
  8. 'title' => t('List'),
  9. 'description' => t('Presents the panes in the form of an HTML list.'),
  10. 'render region' => 'panels_list_style_render_region',
  11. 'settings form' => 'panels_list_style_settings_form',
  12. 'settings validate' => 'panels_list_style_settings_validate',
  13. );
  14. /**
  15. * Render callback.
  16. *
  17. * @ingroup themeable
  18. */
  19. function theme_panels_list_style_render_region($vars) {
  20. $display = $vars['display'];
  21. $region_id = $vars['region_id'];
  22. $panes = $vars['panes'];
  23. $settings = $vars['settings'];
  24. $items = array();
  25. foreach ($panes as $pane_id => $item) {
  26. $items[] = $item;
  27. }
  28. if (empty($settings['list_type'])) {
  29. $settings['list_type'] = 'ul';
  30. }
  31. return theme('item_list', array('items' => $items, 'type' => $settings['list_type']));
  32. }
  33. /**
  34. * Settings form callback.
  35. */
  36. function panels_list_style_settings_form($style_settings) {
  37. $form['list_type'] = array(
  38. '#type' => 'select',
  39. '#title' => t('List type'),
  40. '#options' => array(
  41. 'ul' => t('Unordered'),
  42. 'ol' => t('Ordered'),
  43. ),
  44. '#default_value' => (isset($style_settings['list_type'])) ? $style_settings['list_type'] : 'ul',
  45. );
  46. return $form;
  47. }