Currently HS only show up as Selection type if I use views filter Taxonomy: Term, it doesn't appear if I use views filter Taxonomy: Term ID (with depth). It would be very helpful if HS can be used in Term ID (with depth) filter too.

CommentFileSizeAuthor
#12 hierarchical_select-613428.patch6.54 KBsmartinm

Comments

wim leers’s picture

Priority: Normal » Minor
Status: Active » Postponed

Sounds like it makes sense. Although I don't know how the "Taxonomy: Term ID (with depth)" filter actually works.

Patches are welcome :) Postponed until somebody posts a patch or sponsors this feature.

jrao’s picture

Ok, I think a patch should be easy, although there could be a code duplication issue, since "Taxonomy: Term ID (with depth)" filter is also a subclass of views_handler_filter_term_node_tid.

I think I found an alternative to deal with the situation though: turn on save lineage on my vocabulary, this saves parent term to node and allows a filter on the parent term to display child term's node.

wim leers’s picture

Code duplication: we can create a base class of which we can derive multiple times for both implementation, to share code.

Glad you've find another way though :)

adriancruz’s picture

Priority: Minor » Normal
Status: Postponed » Active

subscribing....

adriancruz’s picture

any patch? save term lineage doesn't work for me. I used HS as exposed filter in my archive, (no results found) It need to choose a term from the deepest level, there's any other way to choose only the parent term? then show all pages related to that parent term? there's any patch? I thinks I need term ID with depth to do this..

Thanks!

wim leers’s picture

Save term lineage does work. But you must enable "save lineage" for both the vocabulary on the node form *and* on the exposed filter. Otherwise it of course cannot work.

This requested patch could be used for special "save lineage" setups, but "save lineage" in se (see the first sentence) should work.

adriancruz’s picture

Hi Wim Leers,

I'm new to drupal and I really want to implement HS in my archive, can you tell me how to enable "save lineage" so my archive can work properly. I'm using HS 6.x-3.x-dev, and Drupal 6.13?

Thanks Wim Leers!

wim leers’s picture

Please read the README.

drenton’s picture

For a workaround, I created a taxonomy term id with depth exposed filter and a taxonomy term id hierarchical select exposed filter. Then in hook_form_alter I copied the hierarchical select one over to the depth one and unset the hierarchical select filter. Seems to work fine.

$form['term_node_tid_depth'] = $form['tid'];
unset($form['tid']);
unset($form['#info']['filter-tid']);
wim leers’s picture

Status: Active » Postponed

Marking as postponed.

fonant’s picture

The "save lineage" option works nicely for new nodes, with the possible disadvantage of adding a whole load of terms for complex items. But I can't see an easy way to retrospectively apply parent terms to all nodes that already exist...

smartinm’s picture

Status: Postponed » Needs review
StatusFileSize
new6.54 KB

Attached a patch to allow "Taxonomy: Term ID (with depth)" filters to be used with Hierarchical Select.

It also fixes a bug in the name of the implementation of the hook hook_views_data_alter.

palyan’s picture

Thanks a lot, smartinm. Your patch is really work!

laroccadahouse’s picture

can we add the option to limit the terms to the selected parent items for exposed filters?

udane’s picture

Thank for the patch. I tried it but it didn't work for me, that's the result:

(Stripping trailing CRs from patch.)
patching file hs_taxonomy_views.module
Hunk #1 FAILED at 180.
Hunk #2 FAILED at 187.
Hunk #3 FAILED at 238.
Hunk #4 FAILED at 560.
4 out of 4 hunks FAILED -- saving rejects to file hs_taxonomy_views.module.rej
(Stripping trailing CRs from patch.)
patching file hs_taxonomy_views_handler_filter_term_node_tid_depth.inc

Can you help me please?

Thanks.

smartinm’s picture

@udane, what exact version are you patching against?

Please apply the patch to the latest dev release (I think this patch works for 6.x-3.6 release too).

$ cd hierarchical_select
$ patch -p0 < ..\hierarchical_select-613428.patch
patching file modules/hs_taxonomy_views.module
patching file modules/hs_taxonomy_views_handler_filter_term_node_tid_depth.inc

Read this for more info: http://drupal.org/patch/apply

udane’s picture

I am using 6.x-3.6
Any solution?
Thanks

udane’s picture

I tried again and this is the result:

$ sudo patch -p0 < ../hierarchical_select-613428.patch
(Stripping trailing CRs from patch.)
patching file modules/hs_taxonomy_views.module
(Stripping trailing CRs from patch.)
patching file modules/hs_taxonomy_views_handler_filter_term_node_tid_depth.inc

But I can't see the "hierarchical select" option in "Display exposed filter as: "

smartinm’s picture

@udane Add or edit a view, add "Taxonmy: Term ID (with depth)" Filter and select "Hierarchical Select" on Selection type.

chuckbar77’s picture

subscribing

wim leers’s picture

Status: Needs review » Fixed

Patch applies cleanly and looks good. Committed. Thanks, smartinm! :)

http://drupal.org/cvs?commit=495026

smartinm’s picture

Status: Fixed » Reviewed & tested by the community

Hi Wim Leers,

I think you forgot to commit the modules/hs_taxonomy_views_handler_filter_term_node_tid_depth.inc new file to CVS.

Thanks.

wim leers’s picture

Status: Reviewed & tested by the community » Fixed

You're absolutely right. Thanks for letting me know. :)

Fixed: http://drupal.org/cvs?commit=496062.

Status: Fixed » Closed (fixed)

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