2

Term::load (termid) can we get the depth of term. If yes how can we achieve ? If no, how can we achieve this without loading tree nor children is there any other way we can fetch depth?

1
  1. You can use TermStorage loadTree function. It will load the whole tree and the depths of each term will be avaiable.
  2. A much more cleaner / efficient way can be to use the "taxonomy_term_hierarchy" table, (database service, select..). You query over and over again till the "parent" (or current examined) term parent is 0.

If you really feel you are being lost, take a look on this thread.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.