Project:Views
Version:6.x-2.x-dev
Component:taxonomy data
Category:feature request
Priority:normal
Assigned:mavimo
Status:needs review
Issue tags:depth, term, views

Issue Summary

Addached patch generate a simple interface into taxonomy field elemento to limit display taxonomy term to specific depth.

Example, into Vocabulary where term in on 4 level, like:

- Music
   - Classic
    - Mozart
      - Ballate

You can display only two level of this tree using config area into term field:
[X]  Limit terms by depth
  Max depth of term:
   __ __ _
  [__2__[V]

I have not find some other module to do that.

Comments

#1

AttachmentSize
term_depth_feature.patch 3.97 KB

#2

Status:needs review» needs work

In general it should run the same code path, when the settings are not changed. But for example you change the sql and add a join to hierachy even if its not needed, like before.

#3

Fixed, also add a small correction into SQL code standard (as => AS)

AttachmentSize
term_depth_feature2.patch 4.08 KB

#4

Status:needs work» needs review

#5

The patch might need some error checking (relationship, etc), see errors I got with random settings

warning: Invalid argument supplied for foreach() in /home/greatbre/public_html/sites/all/modules/views/modules/taxonomy/views_handler_field_term_node_tid.inc on line 118.
warning: Invalid argument supplied for foreach() in /home/greatbre/public_html/sites/all/modules/views/modules/taxonomy/views_handler_field_term_node_tid.inc on line 133.
warning: Invalid argument supplied for foreach() in /home/greatbre/public_html/sites/all/modules/views/modules/taxonomy/views_handler_field_term_node_tid.inc on line 145.

Also, the option is to limit the term by Max depth, what about if we only want to show, for example, terms with depth 2? any interest to add that part?

#6

Status:needs review» needs work

Besides the error checking and the sub-feature request above, the patch works as expected.

#7

@skyredwang: can you give me more info on "random settings" ?
Your feature request can be easy added, I commit it into next hours.

#8

Status:needs work» needs review

Feature required on #5 is up, you can flag each level and system display all the levels indicated into interface (see screenshot).

I thing is also fixed problem with "random configuration", can confirm?

AttachmentSize
term_depth_feature3.patch 4.66 KB
taxonomy-depth.jpeg 22.03 KB

#9

Status:needs review» needs work

@mavimo, thanks for adding the feature. I tested #8 patch. No warning came up, and the UI is the same as your picture. However, there is a bug forcing you to select depth 1 if you have depth 2 or 3 selected. In other words, you cannot display depth 2 only.

#10

Status:needs work» needs review

fixed, tks for your review :)

AttachmentSize
term_depth_feature4.patch 4.73 KB

#11

Status:needs review» reviewed & tested by the community

#10 works great in terms of functionalities. (I didn't review the coding styles)

#12

Fixed coding standard error.
Just variable into query break coding validation, but using placeholder was not correct in this case (I think).

AttachmentSize
term_depth_feature5.patch 5.04 KB

#13

#12 patch also works fine for me

#14

Status:reviewed & tested by the community» needs work

array_combine() is a PHP5 only feature -- Views still supports PHP4.

Try drupal_map_assoc() instead.

#15

Status:needs work» needs review

@merlinofchaos:
Replaced, tks.

AttachmentSize
term_depth_feature6.patch 5.02 KB

#16

Status:needs review» needs work

#15 patch introduces some warning(s)

warning: ksort() expects parameter 1 to be array, null given in /home/*/public_html/sites/all/modules/views/modules/taxonomy/views_handler_field_term_node_tid.inc on line 138.
warning: Invalid argument supplied for foreach() in /home/*/public_html/sites/all/modules/views/modules/taxonomy/views_handler_field_term_node_tid.inc on line 147.

#17

@skyredwang: where do you find this warning? I'm try to use last patch and i don't find any error.
I change only array combine, and if i check the code give the same result:

<?php
$a
= array_combine(range(1, 10), range(1, 10));
$b = drupal_map_assoc(range(1, 10));
dpm($a);
dpm($b);
?>

Can you give me some other info to debug it?

#18

Status:needs work» reviewed & tested by the community

I tested it again. Didn't see the error popping up again. maybe it was caching.... or other things. so I mark it reviewed for now.

#19

subscribing

#20

Very interested in this funcionality... Thank you!

Also subscribing... :P

#21

@skyredwang tks for review!

#22

Thank you so much - this feature has been needed and requested for years!

I have applied the patch and no errors so far, although I did have a little trouble finding where the config settings actually appeared.
I believe it is in a node view, under fields>taxonomy:all terms
and also in a term view under the same field.
That is the only place I found settings matching your jpeg example.

I did run across an issue where I am only seeing level 1 terms unless I actually check "limit terms by depth" and select the depths I want.
"All terms" should display all the terms by default, since that is the point of the "all terms" field.
I have a lot of taxonomy modules installed so I am not sure if it is a conflict somewhere else.

#23

Subscribing.

EDIT: I inserted this patch #15 in views 3.x latest dev. But I didn't see any new fucntionality.
I couldn't find any new setting with node-view taxonomy: all terms and in term-view I am not able to use the field all terms..
Where can I find this functionality please?

greetings, Martijn

#24

This is really so awesome!
I have a site where locations are listed by county, city, and park. In the past I would have to display all 3 levels when sometimes I really only wanted to display the city or the park name. I have also been needing ways to style each level differently in a term view. Now I can use HTML tags!

Do you have a way where we can send donations?

#25

Status:reviewed & tested by the community» needs work

+++ /home/marco/Scrivania/views2/modules/taxonomy/views_handler_field_term_node_tid.inc 2010-04-16 18:16:01.491261656 +0200
@@ -82,14 +102,59 @@ class views_handler_field_term_node_tid
+      if ($this->options['limit_depth']) {
+        $thjoin = " INNER JOIN {term_hierarchy} th ON th.tid = tn.tid";
+        $thselect = " th.parent,";

Please define the variable before. This will throw errors in d7.

+++ /home/marco/Scrivania/views2/modules/taxonomy/views_handler_field_term_node_tid.inc 2010-04-16 18:16:01.491261656 +0200
@@ -82,14 +102,59 @@ class views_handler_field_term_node_tid
+        $temp_term2 = array();
+        foreach ($temp_term as $node_vid => $terms) {
+          foreach ($terms as $parent_tid => $term) {
+            $temp_term2[$node_vid][$term->depth] = $term;
+          }
+          ksort($temp_term2[$node_vid]);
+        }
+
+        $temp_term = $temp_term2;
+      }
+
+      // Reset array structure
+      $temp_term3 = array();
+      foreach ($temp_term as $node_vid => $terms) {
+        foreach ($terms as $parent_tid => $term) {
+          $temp_term3[] = $term;

Would it be possible to have more descriptive array names?

Powered by Dreditor.

My last point is, could you please write a patch for d7, too, but this is optional.

#26

@MBroberg: #24 MY-NICK@gmail.com (paypal) but I think is not necessary send donations to me :)

@MBroberg: #22 - I add it into next patch, thanks for your feedback!

@dereine: #25 I have not test this patch on D7, I add more descriptive name for variable into next day. Tks for your review.

@dereine: #25 I try to write D7 patch into next week.

#27

I hope this feature will also be available in 6.x-3.x =) Great work mavimo!!

#28

Today I found two different bug:

  1. If there are multiple vocabularies the term with parent = 0 just one is display, error is into line:
    <?php
    $temp_term2
    [$node_vid][$term->depth] = $term;
    ?>
  2. Second error occur when on multiple term have the same parent and they are attached to node (same line of code).

I'm writing new patch and test file to solve this error.

#29

Hi!
I got to this thread from: http://drupal.org/node/520520
I was interested in a depth option for CCK content taxonomy fields. I was doing some tests with a non single filter and then I tried having a dropdown where each item had the values of the child items. It didn't really work. The idea is the following:
Have a filter CCK content taxonomy filter with non single options.
For a vocabulary like the following:
1 Term A
--2 Term A1
--3 Term A2
----4 Term A2i
----5 Term A2ii
6 Term B
Have a drowpdown where the values are:
1,2,3,4,5 Term A
--2 Term A1
--3,4,5 Term A2
----4 Term A2i
----5 Term A2ii
6 Term B

Then when selecting one of those, all the items with child terms would show up.
What do you think? Is this a crazy idea? Could it be achieved with some modifications to this code? I don't know much, so far I've been doing my hacks in hook_views_pre_build and I got the widget rendered, but I don't know how to retrieve the values afterwards.

Thanks!

#30

subscribing

#31

subscribing to

#32

Status:needs work» needs review

Fixed:

  • dereine #25: Please define the variable before.
  • dereine #25: Have more descriptive array names?
  • mavimo #28: Multiple vocabularies with term with parent = 0.
  • mavimo #28: Multiple term with the same parent.
  • mavimo: Taxonomy tree not totally associated to node.

Test

manually test this patch with:

Prereq

  • Two different voc (Voc1 and Voc2) associated to contet type (multiple select).
  • Some terms on nested level for each vocabulary (more then one root term, without multiple parents).
  • Create some nodes and add terms to they. Add complete term tree or some term on different level (skip some term on taxonomy tree associated to node).

Tests

  • Views without "Limit terms by vocabulary" ad without "Limit term by depth"
  • Views with "Limit terms by vocabulary" ad without "Limit term by depth"
  • Views without "Limit terms by vocabulary" ad with "Limit term by depth" (level 1)
  • Views without "Limit terms by vocabulary" ad with "Limit term by depth" (level 1, 2)
  • Views without "Limit terms by vocabulary" ad with "Limit term by depth" (level 1, 3)
  • Views with "Limit terms by vocabulary" (voc 1) ad with "Limit term by depth" (level 1)
  • Views with "Limit terms by vocabulary" (voc 1) ad with "Limit term by depth" (level 1, 2)
  • Views with "Limit terms by vocabulary" (voc 1) ad with "Limit term by depth" (level 1, 3)

if someone can do some other test, retest it with different term structure and report error or "misunderstandings" into patch I can improve this feature.

TODO:

  • test file
  • test term with multiple parents. I think it not working fine, multiple parent can comport different depth for each parent, and complexity of algorithm can increase drastically. Can also comport unaxpected result for user; I think is not usefull feature.

Note:

If taxonomy tree is not complete associate to node, to build taxonomy tree each term parent is load. this increase number of query executed into DB; alternative is use taxonomy_get_tree with complete vocabulary tree, but if structure is complex (10^3 terms) memory usage increases dramatically. That's possible remove this feature by remove

<?php
// Parent is not already loaded
elseif (is_null($all_terms[$term->parent])) {
 
$all_terms[$term->parent] = db_fetch_object(db_query('SELECT td.*, th.parent FROM {term_data} td LEFT JOIN {term_hierarchy} th ON td.tid = th.tid WHERE td.tid = %d', $term->parent));
 
$this->_term_get_parents($all_terms, $all_terms[$term->parent]) + 1;
}
?>

from _term_get_parents function, but ter with parent not available are not display.
AttachmentSize
769136-view-taxonomy-deep-feature7.patch 6.23 KB

#33

josepvalls #29: I think your request is on filter (exposed) and not into field. When this feature (#769136: Taxonomy depth as field) is fixed I'll try to improve CCK to add your request, but I think is not views related but CCK related. Can you open a new issue, or use a different issue to discuss this request? tks.

#34

robby.smith #27: I test last patch with views 3 and work fine, if you can do some other test, please report me your results, tks.

dereine #25: I'm working on D7 patch.

#35

Thanks mavimo, it did work with Views 3. Great work!

#36

The patch doesn't apply to version 2.11. Is this issue supposed to be about version 6.x.-3.x-dev?

# patch -p0 < 769136-view-taxonomy-deep-feature7.patch
patching file modules/taxonomy/views_handler_field_term_node_tid.inc
Hunk #1 FAILED at 21.
Hunk #2 succeeded at 34 (offset 2 lines).
Hunk #3 FAILED at 63.
Hunk #4 FAILED at 100.
Hunk #5 succeeded at 200 (offset 25 lines).
3 out of 5 hunks FAILED -- saving rejects to file modules/taxonomy/views_handler_field_term_node_tid.inc.rej

#37

Status:needs review» needs work

So sadly needs work.

#38

Status:needs work» needs review

@flevour: I'm use it on 2.11, and it patch fine from branch DRUPAL-6--2:

cvs -z6 -d:pserver:anonymous:anonymous@cvs.drupal.org:/cvs/drupal-contrib checkout -d views-DRUPAL-6--2 -r DRUPAL-6--2 contributions/modules/views/
cd views-DRUPAL-6--2/
wget http://drupal.org/files/issues/769136-view-taxonomy-deep-feature7.patch
...
-p0 < 769136-view-taxonomy-deep-feature7.patch
patching file modules/taxonomy/views_handler_field_term_node_tid.inc

and with TAR.GZ from 2.11:

wget http://ftp.drupal.org/files/projects/views-6.x-2.11.tar.gz
tar
-xzf views-6.x-2.11.tar.gz
cd views/
wget http://drupal.org/files/issues/769136-view-taxonomy-deep-feature7.patch
...
-p0 < 769136-view-taxonomy-deep-feature7.patch
patching file modules/taxonomy/views_handler_field_term_node_tid.inc

Have you already patched views before apply this patch? Can you check if have the same problem with original copy of views?

#39

My bad, some patches were applied by a make files and I forgot about them. Sorry for wasting your time @mavimo and @dereine.
Francesco

#40

This patch has quite literally saved my sanity. The only way I had found to display a particular level of a taxonomy hierarchy in Views was to use the Custom Field module to call a module function - but there's a sorting bug that affects that method, and it also meant an extra SQL query for every single row of the view. There are so many practical applications for this patch that I expect to be coming back to this page very often until this is absorbed into Views! Thank you.

#41

subscribe

#42

Ok, I got the patch installed and the option comes up. I click the checkbox to select how deep. I am given 10 levels.

My taxonomy has 6 levels:

World Region
Country
State
County
City
Neighborhood

I want to show Country, City

I select 2 and 5.

I save the view. Go back to the page.

I see only Country (2).

Only if I include 1 (World Region) am I able to get anything below Country to show and even then I get extra levels showing.

Right now I have 1, 2, and 5 selected, but 1, 2, 4, and 5 are showing.

Am I maybe doing something wrong?

Thanks a bunch for this patch. It's just what I have been looking for to use on our teaser pages. The full-length pages can have the full listing, but that's too much for the teaser.

After this I've got to figure out how to order these. It puts it in alphabetical order instead of in the order they're in for the depth.

#43

Hi @jsimonis, can you give me more info?

  1. Your content have a taxonomy term for each level?
  2. Your terms have multiple parents?
  3. How many terms have your taxonomy?
    1. tks for your feedback!

#44

I do indeed have taxonomy at every level. I have at least one term at every level just so we could test the setup before we add all of our terms (it's used for locations).

There are not currently multiple parents, as I lose the ability to drag and drop on the taxonomy page once I do that. We've keep it at single parents right now, although that will eventually change.

My taxonomy has a lot of terms. Right now it has the regions of the world, just about every country, all 50 U.S. states, some cities, some counties, etc. We're probably at between 120-150 terms right now across the 6 levels.

Thanks!

#45

I use it on 5 level taxonomy, with 24k terms and display only 2nd and 4th level and it work fine. I can't reproduce the problem. Do you use a vanilla views module or already patched version? Can you give me a "limited version" where I can reproduce the bug? I'll try to find bug, but I can't test it, ...

Tks!

#46

Other than a small edit at the bottom of views_handler_filter_term_node_tid.inc, everything's original to the module.

The bottom of that file looks like this:

  function admin_summary() {
    // set up $this->value_options for the parent summary
    $this->value_options = array();

    if ($this->value) {
      $result = db_query("SELECT * FROM {term_data} td WHERE td.tid IN ('"  . implode("', '", $this->value) . "')");

      while ($term = db_fetch_object($result)) {
        $this->value_options[$term->tid] = $term->name;
      }
    }
    return parent::admin_summary();
  }
}

I'll have to see if I can get you some kind of access.

#47

Does this patch work when Hierarchical Select is being used to "Save term lineage?"

The terms do not appear unless this extra depth filter is set to "1," which then shows ALL the terms, regardless of their depth. The taxonomy definitely has at least 3 sub-levels and therefore at least 3 different depths.

Why isn't this working?

#48

@amaisano: yes, it work fine with Hierarchical Select when use "Save term lineage".

@jsimonis: can you check if this patch solve your problem?

FIXED:

  • #47 reported by amaisano

IMPROVEMENT:

  • Add token ([XXXX-depth]) to customize output when limit term y depth is enabled.
  • Create a view to test this feature (see test section).
  • Optimized code and performance (loop call into recursive function decresed).

TEST:

  1. To test this patch install views and apply patch with:

    wget http://ftp.drupal.org/files/projects/views-6.x-2.11.tar.gz
    tar
    -xzf views-6.x-2.11.tar.gz
    cd views/
    wget http://drupal.org/files/769136-view-taxonomy-deep-feature8.patch
    patch
    -p0 < 769136-view-taxonomy-deep-feature8.patch
  2. generate taxonomy & term (into attachment you can find a taxonomy with 3 level to import using taxonomy_xml
  3. Import view available into attachment with name Views TEST>/em>.
  4. Go to page http://YOURSITE/test/taxonomy_depth/level-1 and ckeck correct display for all the page available.

Please report me if you find some bug or require some improvement.

AttachmentSize
769136-view-taxonomy-deep-feature8.patch 7.1 KB
View TEST 17.08 KB
Taxonomy FIXTURES 776 bytes

#49

#48 Works now, thank you for the patch!

#50

Hi, Would this also work on views 3.x? Would be great!
Thanks for your reply in advance!
greetings, Martijn

#51

Category:task» bug report
Priority:normal» major
Status:needs review» needs work

Hmmm, the file this patch would refer to does even not exist in my drupal folders...
Did I miss something?

C:\website>c:\cygwin\bin\patch.exe -p0 < c:\769136-view-taxonomy-deep-feature8.patch
can't find file to patch at input line 8
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
--------------------------
|Index: modules/taxonomy/views_handler_field_term_node_tid.inc
|===================================================================
|RCS file: /cvs/drupal-contrib/contributions/modules/views/modules/taxonomy/views_handler_field_term_node_tid.inc,v
|retrieving revision 1.4
|diff -u -p -r1.4 views_handler_field_term_node_tid.inc
|--- modules/taxonomy/views_handler_field_term_node_tid.inc 1 Jul 2009 23:07:14 -0000 1.4
|+++ modules/taxonomy/views_handler_field_term_node_tid.inc 26 Nov 2010 13:04:14 -0000
--------------------------
File to patch:

#52

though the file refered to is in
C:\website\modules\views\modules\taxonomy
Now what?

#53

Status:needs work» needs review

@massyboy: Repatched using views 6.20

@Summit: see #35, I'm not using views 3 but same work fine.

AttachmentSize
769136-view-taxonomy-deep-feature9.patch 4.59 KB

#54

You need to be inside the 'views' directory to apply the patch, I think that's why it is failing.

#55

It is working very well for me, but i have another question...
My taxonomy looks like that :
Country
Area
City
City Code
I use this patch to only display the Area and the city, i am not interested in displaying the other informations in this view...
Anyway, how can i sort the results alphabatically ? I can sort using the sort item in the view, but it does not consider which depth i want to sort from, it always sorts with the deepest (for me city code) and it is not what i am interested in...

Could you help me please ?

Thanks

#56

Thanks,
I'll give it a try.
:-)

#57

@SophieG: all tags are relate to node or just deepest term? I think you can open other issue to sort by term (into deep).

#58

@SophieG: fixed problem into taxonomy deep sorting into last patch (feature10)

AttachmentSize
views-769136-feature10.patch 4.59 KB

#59

Looking for same as #55 - need to sort by deepest taxonomy term. Tried patch in #58, but one hunk failed. Here are the details:

patch -p0 < views-769136-feature10.patch
patching file modules/taxonomy/views_handler_field_term_node_tid.inc
Hunk #3 FAILED at 97.
1 out of 3 hunks FAILED -- saving rejects to file modules/taxonomy/views_handler_field_term_node_tid.inc.rej

Using views 6.x-2.12

This would be a fantastic fix, if it worked.

#60

@KCl: try patch feature11, it work fine for me. Let me know if there are some problem.

cvs -z6 -d:pserver:anonymous:anonymous@cvs.drupal.org:/cvs/drupal-contrib checkout -d views-DRUPAL-6--2 -r DRUPAL-6--2 contributions/modules/views/
cd views-DRUPAL-6--2
wget http://drupal.org/files/issues/views-769136-feature11.patch
patch
-p0 < views-769136-feature11.patch
rm views-769136-feature11.patch
AttachmentSize
views-769136-feature11.patch 4.59 KB

#61

The patch installed without any problems, and we are successfully using it to select which taxonomy terms to display. However, we aren't certain if we are using it properly for sorting, or if the patch is supposed to help us achieve what we are trying to do (sort by deepest term). Can you give more information about how to use it for sorting?

Specifically, we have nodes tagged with taxonomy terms of US states and counties. In views, we are grouping the nodes by all terms (ex. county 1, state 1) and we want to be able to sort those groupings alphabetically by the deepest term (county). Is this possible with this patch?

#62

@KCl: this patch just order term in node using term hierarchy, if you join node with term this patch do not solve your problem. I think this element require another handler implementation. I think you can use a term views and not node views to solve your problem.

#63

Subscribe.
Grazie mavimo ;-)

#64

@mandreato: prego :)

#65

Regarding ordering of the terms when more than one vocabulary is used, is it possible to add the vocabulary' weights first (at least, an option to choose if considering vocabulary weight ordering) ?

For example: I have a node linked to three vocabulary (V1, V2, V3) and every vocabulary has its own weight (V1=1, V2=2, V3=3). Then the linked terms are (T1 from V1, T2 from V2 and T3 from V3) and every term has its own weight relative to its vocabulary.
It happens that T1 has weight=2, T2 has weight=1 and T3 has weight=1.
Since the All Terms field shows the terms ordered by term's weight, they are listed as T2, T3, T1, ...
Instead, I need to list them as T1, T2, T3.

Maybe this is a request that could be issued to Views module, but since this patch is addressing that part of code... I hope it can be resolved here and then have the patch merged into 6.x.-3.x-dev.

Thanks In Advance.

#66

#67

Category:bug report» feature request
Priority:major» normal

Hi!

Please forgive me, if I'm posting here wrong (me newbie)

I've been working on taxonomy exposed filters with depth.

My job was to make the drop down to show ONLY the terms which are used by the content type in the view.
eg. : not showing a city if there are not valid coupons on that location (that city exists because some other content type uses it)

I did this by removing options on the form. I think it would be better to add the "used" condition as a sub query when fetching the cities. Here it is:

function helper_form_alter(&$form, $form_state, $form_id) {
if($form_state['view']->name == 'my_faves') {//my view name
$citiesWithCoupon = get_valid_coupon_cities(); //simple array of $id=>$name with the terms I want to keep on the drop down
foreach($form['couponlist']['#options'] as $key => $option) {
if ($key !== 'All' && ! (in_array(key($option->option),array_keys($citiesWithCoupon) ) ) ){//I know, it would be nice to have the array flip(), but in my case values can be repeated so loosing entries when flip
unset($form['couponlist']['#options'][$key]);
}
}
}
}

The other part of the code is lengthy, but basically it goes for all the elements fetching the related terms on the desired vocabulary. Then it retrieves parents for those terms until there are no more to fetch (loop).

I think this is a feature other people could use, but

1) I've never posted a patch to drupal
2) my solution will need adjustements to be a general solution instead of this code.

Can somebody help me find the proper place for contribute?

#68

Hi,

great work mavimo :-)

Just to clarify - does this work on the term: term as well as the node:term?

And to the maintainers do you think this is near commit?

cheers, joe

#69

The patch at #60 doesn't seem to work for me. I get the following error when I attempt to patch:

$ patch -p0 < views-769136-feature11.patch
patching file modules/taxonomy/views_handler_field_term_node_tid.inc
Hunk #2 succeeded at 94 with fuzz 2 (offset 34 lines).
Hunk #3 FAILED at 131.
1 out of 3 hunks FAILED -- saving rejects to file modules/taxonomy/views_handler_field_term_node_tid.inc.rej

Any advice on where to go from here?

#70

@delugestudios: please try patch into attachment.

AttachmentSize
views-769136-feature12.patch 4.59 KB

#71

hi
I ve tried to apply the patch on #70 but i can t see the feature. I am editing a Taxonomy View, maybe that s why?

This feature should really come in standard Views..
tx

Simone

#72

subscribing

#73

@mavimo, thank you for great feature!
Can we use this patch to filter terms by depth inside of "Taxonomy view"?

#74

The same request as #73

Created separate issue here: #1093680: Filter terms by depth inside of "Taxonomy view"
Different file (views_handler_field_taxonomy.inc), but similar code.

UPDATE:
#73, #74 related issues:
#903438: Let taxonomy views have a Term ID with depth as well
#1073170: Taxonomy: Term ID (with depth) : filter on term_node, not on node

#75

@intyms / @kenorb: this patch provvide only taxonomy visualization, it is not usable to filter content from taxonomy depth.

#76

subscribing

#77

$all_term[$term->node_vid][$term->parent] = $term;

Line above means that only one child term can be displayed per parent term.

#78

@mavimo #70 patch doesn't work for me neither #60 patch. I am using views-6.x-2.12.

patch -p0 < views-769136-feature12.patch
patching file modules/taxonomy/views_handler_field_term_node_tid.inc
Hunk #3 FAILED at 97.
1 out of 3 hunks FAILED -- saving rejects to file modules/taxonomy/views_handler_field_term_node_tid.inc.rej

#79

Got same results as #78, but manually applied, patch in #70 works with Views 6x-2.12
As per #77, I am only seeing one child term per parent term.
With previous patch way back at #15 on Views 6x-2.9 I was seeing multiple terms per parent.

CORRECTION: it was with Views 6x-2.8, sorry!

#80

Correction, the behavior is much weirder.
I have a hierarchy of locations in the format county>city>park.
Most events have one sequence attached, but a few events have more than one park/county since the park is on the border of a town.

For my test, I chose an event that has:
county1>city1>park1
and
county2>city2
for a total of 5 terms attached at 3 different depth levels.
All 5 terms are attached, and filters for those terms work fine. It is just a display issue.

In the view, for this particular event I have tried various combinations of checkboxes with these results:

uncheck limit by vocabulary
uncheck limit by depth
I see just county2

check limit by vocabulary and select the vocab
uncheck limit by depth
I see just county2 (same result as above)

check limit by vocabulary and select the vocab
check limit by depth but do not select any depth
I see no terms for most of the list items, but for the event that has 5 terms as described, I see just city1

check limit by vocabulary and select the vocab
check limit by depth and select depth of 1
I see county2, city1

check limit by vocabulary and select the vocab
check limit by depth and select depth of 1 and 2
I see city1, county2, city2

check limit by vocabulary and select the vocab
check limit by depth and select depth of 1 and 2 and 3
I see city1, county2, city2 (same as above, no depth 3 terms)

check limit by vocabulary and select the vocab
check limit by depth and select depth of 2 and 3
I see city1, city2 (no depth 3 terms)

check limit by vocabulary and select the vocab
check limit by depth and select depth of just 2
I see city1, city2 (as desired)

check limit by vocabulary and select the vocab
check limit by depth and select depth of just 3
I see city2 (no depth 3 terms)

In all listings this is only an issue in a hierarchy with multiple term levels and several different trees.
When the listing has several terms but all in one tree, every setting works as expected.

#81

Subscribing

#82

@MBroberg:how do you add more then one vocabulary tree to node? Using default taxonomy term selection?

#83

Maybe I am using the wrong words. I mean I usually attach one "branch" worth of terms, which is a single county, and a single city, and a single park.

I use hierarchical select module to select the terms at each depth level, and I attach all 3 terms. In those cases it mostly works OK, with the exception that if "Limit by depth" box is not checked, I see nothing.

When I add several branches of terms, that is when I have problems. For example I add first county, first city, and first park, (using HS module) then I also attach a second branch which is second county and second city (also using HS module).

I know all the terms are attached. They do show up without the patch, and they do work with the filters.

#84

Also, this all worked with your older patch, until I had to upgrade to Views 6.x-2.12 a few days ago for other reasons. Before that I had Views 6.x-2.8 and the older patch. Everything worked well with the same data I have currently.

#85

My husband has been working on this and he says it is an issue of multiple terms with same parent (even if term is at top level and has no parent), confirming #77. He is working on some code to fix but he is not that familiar with Drupal.

#86

This functionality would be even more practical in an external module like Views Hacks or a standalone.

But thanks for the work!

The only other option to mimic this behaviour is by limiting the depth of a Content Taxonomy field in the editor at the moment (+ Conditional Fields to save possible sub-terms via another Content Taxonomy field).

#87

I have a question

Why is this written as a patch and not as a module? I try not to patch my site to much...

#88

@ymeiner: it's easy generate a module from it, but i start to write a patch to add this features into views core and not as a separate module.

#89

+1 for module, so it is also usable in views 3!
Greetings, Martijn

#90

@Summit a module don't mean it is compatible with views3 (different system to work with DBL), but I'll try to move it to a module and add compatibilty to Views3.

#91

a new module is wrong direction. we simply need to get the latest patch tested, so we can commit it. So, everyone please help.