Created
June 20, 2013 04:06
-
-
Save orakili/5820243 to your computer and use it in GitHub Desktop.
Fix facet date granularity for the Drupal 7 search_api module version 1.6.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/contrib/search_api_facetapi/plugins/facetapi/query_type_date.inc b/contrib/search_api_facetapi/plugins/facetapi/query_type_date.inc | |
index 7277b56..0610d83 100644 | |
--- a/contrib/search_api_facetapi/plugins/facetapi/query_type_date.inc | |
+++ b/contrib/search_api_facetapi/plugins/facetapi/query_type_date.inc | |
@@ -204,9 +204,15 @@ class SearchApiFacetapiDate extends SearchApiFacetapiTerm implements FacetapiQue | |
} | |
// Adds parent information if not already set. | |
- if (NULL !== $parent && $parent != $new_value) { | |
- $build[$parent]['#item_children'][$new_value] = &$build[$new_value]; | |
- $build[$new_value]['#item_parents'][$parent] = $parent; | |
+ if (NULL !== $parent) { | |
+ if ($parent != $new_value) { | |
+ $build[$parent]['#item_children'][$new_value] = &$build[$new_value]; | |
+ $build[$new_value]['#item_parents'][$parent] = $parent; | |
+ } | |
+ // If the parent is the same as the value then it's the end. | |
+ else { | |
+ break; | |
+ } | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment