Output topic parent

Permalink
I have a custom topic set up with topics organized in folders. Using the page list block I would like to output the selected topic name along with the parent folder name, but haven't been able to find out how that is done.

I get the selected topic(s) using this code:
$topic = $page->getAttribute('custom_topic');
echo $custom_topic->getTreeNodeDisplayName();

How would I add the parent topic/folder to this?

Thanks
Michael

 
MrKDilkington replied on at Permalink Reply
MrKDilkington
Hi skorge,

Here is a quick example using the "blog_entry_topics" as an example:
// $topicAttribute is an array of one or more selected topics
$topicAttribute = $page->getAttribute('blog_entry_topics');
// if only one topic is selected, you can use the first array element to get the first topic object
echo $topicAttribute[0]->getTreeNodeDisplayName();
// using the first topic object, you can get its parent object
$topicAttributeParent = $topicAttribute[0]->getTreeNodeParentObject();
echo $topicAttributeParent->getTreeNodeDisplayName();