Is there any function of joomla that gives the top most parent of a subcategory? Like, I have this structure-

If I have id of "Components" than how could I get "Sample Data-Articles".
Thanks.
Is there any function of joomla that gives the top most parent of a subcategory? Like, I have this structure-

If I have id of "Components" than how could I get "Sample Data-Articles".
Thanks.
getPathRoot を使用して、最後から 2 番目のノードを選択できます (最後のノードは、それ自体はカテゴリではないカテゴリ ルートです)。 https://github.com/joomla/joomla-platform/blob/staging/libraries/joomla/table/nested.php#L126 または https://github.com/joomla/joomla-platform/blob/staging/libraries/ legacy/categories/categories.php#L932