views-exposed-form.tpl.php

  1. 3.x theme/views-exposed-form.tpl.php
  2. 2.x theme/views-exposed-form.tpl.php

This template handles the layout of the views exposed filter form.

Variables available:

  • $widgets: An array of exposed form widgets. Each widget contains:
  • $widget->label: The visible label to print. May be optional.
  • $widget->operator: The operator for the widget. May be optional.
  • $widget->widget: The widget itself.
  • $sort_by: The select box to sort the view using an exposed form.
  • $sort_order: The select box with the ASC, DESC options to define order. May be optional.
  • $items_per_page: The select box with the available items per page. May be optional.
  • $offset: A textfield to define the offset of the view. May be optional.
  • $reset_button: A button to reset the exposed filter applied. May be optional.
  • $button: The submit button for the form.

File

theme/views-exposed-form.tpl.php
View source
  1. <?php
  2. /**
  3. * @file
  4. * This template handles the layout of the views exposed filter form.
  5. *
  6. * Variables available:
  7. * - $widgets: An array of exposed form widgets. Each widget contains:
  8. * - $widget->label: The visible label to print. May be optional.
  9. * - $widget->operator: The operator for the widget. May be optional.
  10. * - $widget->widget: The widget itself.
  11. * - $sort_by: The select box to sort the view using an exposed form.
  12. * - $sort_order: The select box with the ASC, DESC options to define order. May be optional.
  13. * - $items_per_page: The select box with the available items per page. May be optional.
  14. * - $offset: A textfield to define the offset of the view. May be optional.
  15. * - $reset_button: A button to reset the exposed filter applied. May be optional.
  16. * - $button: The submit button for the form.
  17. *
  18. * @ingroup views_templates
  19. */
  20. ?>
  21. <?php if (!empty($q)): ?>
  22. <?php
  23. // This ensures that, if clean URLs are off, the 'q' is added first so that
  24. // it shows up first in the URL.
  25. print $q;
  26. ?>
  27. <?php endif; ?>
  28. <div class="views-exposed-form">
  29. <div class="views-exposed-widgets clearfix">
  30. <?php foreach ($widgets as $id => $widget): ?>
  31. <div id="<?php print $widget->id; ?>-wrapper" class="views-exposed-widget views-widget-<?php print $id; ?>">
  32. <?php if (!empty($widget->label)): ?>
  33. <label for="<?php print $widget->id; ?>">
  34. <?php print $widget->label; ?>
  35. </label>
  36. <?php endif; ?>
  37. <?php if (!empty($widget->operator)): ?>
  38. <div class="views-operator">
  39. <?php print $widget->operator; ?>
  40. </div>
  41. <?php endif; ?>
  42. <div class="views-widget">
  43. <?php print $widget->widget; ?>
  44. </div>
  45. <?php if (!empty($widget->description)): ?>
  46. <div class="description">
  47. <?php print $widget->description; ?>
  48. </div>
  49. <?php endif; ?>
  50. </div>
  51. <?php endforeach; ?>
  52. <?php if (!empty($sort_by)): ?>
  53. <div class="views-exposed-widget views-widget-sort-by">
  54. <?php print $sort_by; ?>
  55. </div>
  56. <div class="views-exposed-widget views-widget-sort-order">
  57. <?php print $sort_order; ?>
  58. </div>
  59. <?php endif; ?>
  60. <?php if (!empty($items_per_page)): ?>
  61. <div class="views-exposed-widget views-widget-per-page">
  62. <?php print $items_per_page; ?>
  63. </div>
  64. <?php endif; ?>
  65. <?php if (!empty($offset)): ?>
  66. <div class="views-exposed-widget views-widget-offset">
  67. <?php print $offset; ?>
  68. </div>
  69. <?php endif; ?>
  70. <div class="views-exposed-widget views-submit-button">
  71. <?php print $button; ?>
  72. </div>
  73. <?php if (!empty($reset_button)): ?>
  74. <div class="views-exposed-widget views-reset-button">
  75. <?php print $reset_button; ?>
  76. </div>
  77. <?php endif; ?>
  78. </div>
  79. </div>

Related topics