views-exposed-form.tpl.php

Same filename in other branches
  1. 7.x-3.x theme/views-exposed-form.tpl.php

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
<?php


/**
 * @file 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.
 *
 * @ingroup views_templates
 */
if (!empty($q)) {
    ?>
  <?php

    // This ensures that, if clean URLs are off, the 'q' is added first so that
    // it shows up first in the URL.
    print $q;
}
?>
<div class="views-exposed-form">
  <div class="views-exposed-widgets clear-block">
    <?php

foreach ($widgets as $id => $widget) {
    ?>
      <div class="views-exposed-widget views-widget-<?php

    print $id;
    ?>">
        <?php

    if (!empty($widget->label)) {
        ?>
          <label for="<?php

        print $widget->id;
        ?>">
            <?php

        print $widget->label;
        ?>
          </label>
        <?php

    }
    ?>
        <?php

    if (!empty($widget->operator)) {
        ?>
          <div class="views-operator">
            <?php

        print $widget->operator;
        ?>
          </div>
        <?php

    }
    ?>
        <div class="views-widget">
          <?php

    print $widget->widget;
    ?>
        </div>
      </div>
    <?php

}
?>
    <?php

if (!empty($sort_by)) {
    ?>
      <div class="views-exposed-widget views-widget-sort-by">
        <?php

    print $sort_by;
    ?>
      </div>
      <div class="views-exposed-widget views-widget-sort-order">
        <?php

    print $sort_order;
    ?>
      </div>
    <?php

}
?>
    <?php

if (!empty($items_per_page)) {
    ?>
      <div class="views-exposed-widget views-widget-per-page">
        <?php

    print $items_per_page;
    ?>
      </div>
    <?php

}
?>
    <?php

if (!empty($offset)) {
    ?>
      <div class="views-exposed-widget views-widget-offset">
        <?php

    print $offset;
    ?>
      </div>
    <?php

}
?>
    <div class="views-exposed-widget views-submit-button">
      <?php

print $button;
?>
    </div>
    <?php

if (!empty($reset_button)) {
    ?>
      <div class="views-exposed-widget views-reset-button">
        <?php

    print $reset_button;
    ?>
      </div>
    <?php

}
?>
  </div>
</div>

Related topics