This has been discussed before in #1377628-7: taxonomy_get_term_by_name() should be taxonomy_term_load_multiple_by_name() ff, but deferred to a followup which finally didn't get filed.
"load_parents_all" is bulky, unintuitive and easy to confuse. "load_descendants" would be much clearer.
There's also been some discussion in #251595: Add taxonomy_term_load_descendents(). However this rename would make sense, whether that one lands or not.
Note that it's also debatable whether the function should include the actual term itself. In the end, a term isn't its own parent, nor descendant. We could add a switch parameter "include_self" to keep it convenient while documenting that oddity. However that might be out of scope here.
| Comment | File | Size | Author |
|---|---|---|---|
| #1 | taxonomy_term_ancestors-2043163-1.patch | 3.14 KB | pancho |
Comments
Comment #1
panchoNote that this is an API change, even though it might be considered acceptable, after the function has already been renamed in D8 from D7's taxonomy_get_parents_all().
Should go in before the first beta lands, though.
Comment #2
panchoComment #3
larowlanI'd rather we did it in #1976298: Move taxonomy_get_tree() and associated functions to Taxonomy storage, deprecate procedural wrappers.
Comment #4
panchoSure, but it remains completely unclear if the other one lands in time, so taxonomy_term_load_parents_all() can still be removed. The last patch there doesn't even include all related functions.
If we really need a procedural wrapper, though all of these were renamed in D8, it should be rightaway taxonomy_term_load_ancestors().
So I'd really propose to consider this one as a quick followup to #1377628: taxonomy_get_term_by_name() should be taxonomy_term_load_multiple_by_name(), while discussion and work goes on in #1976298: Move taxonomy_get_tree() and associated functions to Taxonomy storage, deprecate procedural wrappers.
Comment #5
jhedstromtaxonomy_term_load_parents_all()was marked as deprecated in #1976298: Move taxonomy_get_tree() and associated functions to Taxonomy storage, deprecate procedural wrappers., and will be removed before 8.0.0.