You are here

function taxonomy_term_depth_get_full_chain in Taxonomy Term Depth 8.2

Same name and namespace in other branches
  1. 8 taxonomy_term_depth.module \taxonomy_term_depth_get_full_chain()
  2. 7 taxonomy_term_depth.module \taxonomy_term_depth_get_full_chain()

Gets full chain of terms, including term itself

Parameters

$tid:

Return value

array

1 call to taxonomy_term_depth_get_full_chain()
DynamicDepthCalculationTest::testCalculateDepth in tests/src/Functional/DynamicDepthCalculationTest.php
Creates and ensures that a feed is unique, checks source, and deletes feed.

File

./taxonomy_term_depth.module, line 254
Main module file.

Code

function taxonomy_term_depth_get_full_chain($tid, $reversed = FALSE) {
  $parents = taxonomy_term_depth_get_parents($tid, TRUE);
  $children = taxonomy_term_depth_get_children($tid, TRUE);
  $chain = array_merge($parents, [
    $tid,
  ], $children);
  return $reversed ? array_reverse($chain) : $chain;
}