Great module - thank you!

Here's a template file that's more like what you normally see in Drupal - HTML with PHP snippets. I added an if to hide the template's HTML if no exposed filters are active and also an array() check and an implode() to process arrays:

<?php
/**
 * @file
 * Basic template file
 */
?>
<?php if ($exposed_filters): ?>
  <div class="exposed_filter_data">
    <div class="title">Filtered by:</div>
    <div class="content">
      <?php foreach ($exposed_filters as $filter => $value): ?>
        <?php if ($value): ?>
          <div class="filter"><div class="name"><?php print $filter; ?>: </div>
          <?php if (is_array($value)): ?>
            <div class="value"><?php print implode(', ', $value); ?></div></div>
          <?php else: ?>
            <div class="value"><?php print $value; ?></div></div>
          <?php endif; ?>
        <?php endif; ?>
      <?php endforeach; ?>
    </div>
  </div>
<?php endif; ?>
CommentFileSizeAuthor
#4 exposed_filter_data-1754396-4.patch1.31 KBstar-szr

Comments

jrstmartin’s picture

Issue summary: View changes

Oops

johndp’s picture

Category: feature » support

This is great, thank you very much!

Can you tell me a quick way to print the Term Name rather than the Term ID?

jrstmartin’s picture

Sure see here: https://gist.github.com/3484977#file_exposed_filter_data.tpl.php starting on line 27. That code assumes you're using "tid" for the value of the Filter Identifier in your exposed filter. Change it as needed.

johndp’s picture

Thanks for this. I'm still not able to get it to work though, it's still printing the $tid for some reason. Hopefully I'll work it out though, thanks again

star-szr’s picture

Version: 6.x-1.1 » 7.x-1.0
Category: support » feature
Status: Active » Needs review
StatusFileSize
new1.31 KB

@jrstmartin - Thanks for posting this, certainly a big improvement from the default template.

Here's a patch that applies to both 7.x-1.x and 6.x-1.x. Changes from the original post:

  1. Wraps "Filtered by:" in t()
  2. Moves the closing tag for <div class="filter"> outside of the array handling block.
shushu’s picture

Assigned: Unassigned » shushu

@jrstmartin, @Cottser - 10x !
While I don't have too much time to spend on it, I do want the module to get better.
So I put the patch into the dev revisions and released them (suppose to be there in a bit).
If you can verify it works on the dev, I will be happy to release a stable version out of it.
While doing this, any of you can/want to co-maintain the module with me ?

shushu’s picture

Version: 7.x-1.0 » 7.x-1.x-dev
shushu’s picture

Issue summary: View changes

Oops