From ac83d9b40de7f3d4eb8e5ee73580496d6b25d96c Mon Sep 17 00:00:00 2001
From: kotnik <kotnik@16132.no-reply.drupal.org>
Date: Mon, 4 Jun 2012 17:18:06 +0200
Subject: [PATCH] Issue #1616518 by kotnik: Show active search term.

---
 .../plugins/current_search/item_active.inc         |   22 +++++++++++++++-----
 1 file changed, 17 insertions(+), 5 deletions(-)

diff --git a/contrib/current_search/plugins/current_search/item_active.inc b/contrib/current_search/plugins/current_search/item_active.inc
index c25fc36..9c2e138 100644
--- a/contrib/current_search/plugins/current_search/item_active.inc
+++ b/contrib/current_search/plugins/current_search/item_active.inc
@@ -19,15 +19,27 @@ class CurrentSearchItemActive extends CurrentSearchItem {
     // Makes sure facet builds are initialized.
     $adapter->processFacets();
 
-    // Adds the keywords if any were passed.
-    if ($this->settings['keys'] && $adapter->getSearchKeys()) {
-      $items[] = check_plain($adapter->getSearchKeys());
-    }
-
     // Initializes links attributes, adds rel="nofollow" if configured.
     $attributes = ($this->settings['nofollow']) ? array('rel' => 'nofollow') : array();
     $attributes += array('class' => array());
 
+    // Adds the keywords if any were passed.
+    if ($this->settings['keys'] && $adapter->getSearchKeys() && $adapter->getSearchKeys() != '[all items]') {
+      $facets = !empty($_GET['f']) ? array('f' => $_GET['f']) : array();
+
+      $variables = array(
+        'text' => check_plain($adapter->getSearchKeys()),
+        'path' => request_path(),
+        'options' => array(
+          'attributes' => $attributes,
+          'html' => TRUE,
+          'query' => $facets,
+        ),
+      );
+
+      $items[] = theme('facetapi_link_active', $variables);
+    }
+
     // Gets the translated pattern with token replacements in tact.
     $pattern = $this->translate('pattern', $this->settings['pattern']);
 
-- 
1.7.10.2

