Taxonomy function to filter $tree by parent and depth

robertDouglass - November 11, 2005 - 16:18
Project:Drupal
Version:7.x-dev
Component:taxonomy.module
Category:feature request
Priority:normal
Assigned:Unassigned
Status:closed
Description

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 KBIgnoredNoneNone

#1

robertDouglass - November 11, 2005 - 16:22

getting rid of tabs (stupid IDE)

AttachmentSizeStatusTest resultOperations
taxonomy.module_0.txt1.43 KBIgnoredNoneNone

#2

robertDouglass - November 11, 2005 - 16:23

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

drumm - May 3, 2006 - 08:52
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

robertDouglass - May 3, 2006 - 14:05

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

robertDouglass - May 3, 2006 - 14:07

create_function ... ok, got it.

#6

LAsan - March 27, 2008 - 16:54
Version:x.y.z» 7.x-dev
Status:needs work» fixed

create_function ... ok, got it.

I guess this a fixed issue.

#7

Anonymous (not verified) - April 10, 2008 - 17:37
Status:fixed» closed

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

#8

pydubreucq - November 9, 2009 - 14:19

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

 
 

Drupal is a registered trademark of Dries Buytaert.