/**
* Method to get an array of tag ids for the current tag and its children
*
* @param integer $id An optional ID
* @param array &$tagTreeArray Array containing the tag tree
*
* @return mixed
*
* @since 3.1
*/
public function getTagTreeArray($id, &$tagTreeArray = array())
{
// Get a level row instance.
$table = Factory::getApplication()->bootComponent('com_tags')->getMVCFactory()->createTable('Tag', 'Administrator');
if ($table->isLeaf($id)) {
$tagTreeArray[] = $id;
return $tagTreeArray;
}
$tagTree = $table->getTree($id);
// Attempt to load the tree
if ($tagTree) {
foreach ($tagTree as $tag) {
$tagTreeArray[] = $tag->id;
}
return $tagTreeArray;
}
}