Problem/Motivation

Notice: Undefined index: f in FacetapiWidgetTabLinks->execute() (line 48 of facetapi_tabs/plugins/facetapi/widget_tab_links.inc).

Looks like maybe a mistake from the last set of fixes.

      if (isset($e['#query']['f']) && is_array($e['#query']['f'])) {
        foreach ($all['#query']['f'] as $key => $value) {
          $temp = explode(':', $value);
          if ($temp[0] == $this->facet['field alias']) {
            unset($all['#query']['f'][$key]);
          }
        }
      }

Proposed resolution

$all should be $e?

Remaining tasks

User interface changes

API changes

CommentFileSizeAuthor
#2 notice_undefined-2382157-2.patch1.53 KBjoelpittet

Comments

joelpittet’s picture

Seems like this change is what did this in:

--- a/html/sites/all/modules/contrib/facetapi_tabs/plugins/facetapi/widget_tab_links.inc
+++ b/html/sites/all/modules/contrib/facetapi_tabs/plugins/facetapi/widget_tab_links.inc
@@ -15,13 +15,12 @@ class FacetapiWidgetTabLinks extends FacetapiWidgetLinks {
     $element = &$this->build[$this->facet['field alias']];

     $total_count = 0;
-    $all_active = 1;
     foreach ($element as &$e) {
       // Tally up the total hits for the "All" tab.
       $total_count += $e['#count'];

       if ($e['#active']) {
-        $all_active = 0;
+        $active = $e;
       }

       // For each link, drop any active facet that isn't defined by the
@@ -39,10 +38,12 @@ class FacetapiWidgetTabLinks extends FacetapiWidgetLinks {

     if ($this->settings->settings['show_all']) {
       // Create the "All" tab using the last looped filter as the base.
-      $all = $e;
+      $all = isset($active) ? $active : $e;
       $all['#markup'] = t('All');
       $all['#count'] = $total_count;
-      $all['#active'] = $all_active;
+      $all['#active'] = isset($active) ? FALSE : TRUE;
+      $all['#path'] = isset($active) ? $all['#path'] : current_path();
+
       if (isset($e['#query']['f']) && is_array($e['#query']['f'])) {
         foreach ($all['#query']['f'] as $key => $value) {
           $temp = explode(':', $value);
joelpittet’s picture

Status: Active » Needs review
StatusFileSize
new1.53 KB

I'm thinking this is the fix.

hypertext200’s picture

Status: Needs review » Fixed

joelpittet’s picture

Thanks @heshan.lk

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.