summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Borchert2013-01-19 15:53:07 (GMT)
committer Stefan Borchert2013-01-19 15:53:07 (GMT)
commit1e4a5219419957217e7f53638fa9913d8f8c3f1e (patch)
treecd3b46a0f89fa2cdc461035b5e5f9609b9c82c97
parent69b3e92d187c9bdd725b1f0392fabb815c289e63 (diff)
Fixing issues with views exposed filter not displaying the correct hierarchy.7.x-1.3
Signed-off-by: Stefan Borchert <stefan.borchert@undpaul.de>
-rw-r--r--includes/handlers/shs_handler_filter_term_node_tid.inc11
-rw-r--r--js/shs.js2
-rw-r--r--shs.module1
3 files changed, 8 insertions, 6 deletions
diff --git a/includes/handlers/shs_handler_filter_term_node_tid.inc b/includes/handlers/shs_handler_filter_term_node_tid.inc
index f507f42..f0b03aa 100644
--- a/includes/handlers/shs_handler_filter_term_node_tid.inc
+++ b/includes/handlers/shs_handler_filter_term_node_tid.inc
@@ -134,10 +134,12 @@ class shs_handler_filter_term_node_tid extends views_handler_filter_many_to_one
}
$parents = array();
- if (!empty($default_value)) {
- $term_parents = taxonomy_get_parents($default_value);
- foreach ($term_parents as $tid => $term) {
- $parents[] = array('tid' => $tid);
+ if (!empty($default_value) && $default_value != 'All') {
+ $term_parents = taxonomy_get_parents_all($default_value);
+ // Remove selected term from list.
+ array_shift($term_parents);
+ foreach (array_reverse($term_parents) as $term) {
+ $parents[] = array('tid' => $term->tid);
}
// Add current term (name not needed).
$parents[] = array('tid' => $default_value);
@@ -398,7 +400,6 @@ class shs_handler_filter_term_node_tid extends views_handler_filter_many_to_one
$this->value_options = array();
if ($this->value) {
- $this->value = array_filter($this->value);
$result = db_select('taxonomy_term_data', 'td')
->fields('td')
->condition('td.tid', $this->value)
diff --git a/js/shs.js b/js/shs.js
index a9c8a5b..2b89210 100644
--- a/js/shs.js
+++ b/js/shs.js
@@ -40,7 +40,7 @@
// Use current term id as parent id for the next level.
parent_id = parent.tid;
});
- if (level > 1) {
+ if (level > 1 && (settings.shs[fieldName].settings.create_new_terms && settings.shs[fieldName].settings.create_new_levels)) {
// Try to add one additional level.
$select = shsElementCreate($field.attr('id'), settings.shs[fieldName], level);
$select.appendTo($field.parent());
diff --git a/shs.module b/shs.module
index e5e04cd..a3b715e 100644
--- a/shs.module
+++ b/shs.module
@@ -370,6 +370,7 @@ function shs_field_formatter_settings_summary($field, $instance, $view_mode) {
function shs_field_formatter_prepare_view($entity_type, $entities, $field, $instances, $langcode, &$items, $displays) {
foreach ($entities as $entity_id => $entity) {
foreach ($items[$entity_id] as $delta => $item) {
+ $items[$entity_id][$delta]['parents'] = array();
// Load list of parent terms.
$parents = taxonomy_get_parents_all($item['tid']);
// Remove current term from list.