Download & Extend

Taxonomy function to filter $tree by parent and depth

Project:Drupal core
Version:7.x-dev
Component:taxonomy.module
Category:feature request
Priority:normal
Assigned:Unassigned
Status:closed (fixed)

Issue Summary

Sometimes you have a taxonomy tree and you'd like to get all of the terms at a certain depth, or all the terms at a certain depth belonging to a certain parent. These are a set of filter functions to do that. (it's not a patch since these functions just need to be added to taxonomy.module, and I didn't know where in the module they would look the best)

AttachmentSizeStatusTest resultOperations
taxonomy.module.txt1.42 KBIgnored: Check issue status.NoneNone

Comments

#1

getting rid of tabs (stupid IDE)

AttachmentSizeStatusTest resultOperations
taxonomy.module_0.txt1.43 KBIgnored: Check issue status.NoneNone

#2

One question I have about this code is whether the following function is necessary, or if there is a PHP native way to get rid of null array values?

<?php
/**
* Utility function used by taxonomy_filter_tree
*/
function taxonomy_filter_not_null($term) {
  return !
is_null($term);
}
?>

#3

Priority:critical» normal
Status:needs review» needs work

- Not critical.
- Who else wants this feature?
- Not a patchfile.
- That function can be abbreviated away with create_function.

#4

Don't know how it got set critical... it most certainly isn't.

What do you mean abbreviated away?

I didn't submit a patch file since I wanted the maintainer to have the discretion of where to put the extra functions. At the end of the taxonomy.module file?

#5

create_function ... ok, got it.

#6

Version:x.y.z» 7.x-dev
Status:needs work» fixed

create_function ... ok, got it.

I guess this a fixed issue.

#7

Status:fixed» closed (fixed)

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

#8

Hi,
I thinks It could be very interesting to have that...
I will test this function
Thanks for all ;)
Bye