Concrete5.7.5.2 - How to get Topics tree attributes values into a select box?

I have a Topics tree which I use as an attribute on a page:

-Topic 1
-Topic 2
-Topic 3

How can I get the topics into an array in a block? Which I can then use in a select box? e.g.
$topics = ("Topic 1", "Topic 2", "Topic 3);
echo $form->select('categories', $topics);

And if my select box is on the right most side of the page, it always has the right border missing. If I move it anywhere else, it shows fine. Anyone else have this?

BTW, for those who want to get values from a select box attribute:
use Concrete\Core\Attribute\Key\CollectionKey as CollectionKey;
use Concrete\Attribute\Select\Controller as SelectController;
use Concrete\Core\Attribute\Type as AttributeType;
$ak = CollectionKey::getByHandle('region');
$at = AttributeType::getByHandle('select');
$satc = new SelectController($at);
$values = $satc->getOptions()->getOptions();
foreach ($values as $key => $value) {
   $this->options[$value->getSelectAttributeOptionID()] = $value->getSelectAttributeOptionValue();

View Replies: View Best Answer
linuxoid replied on at Permalink Best Answer Reply
Thanks to Mike (, here's a piece of working code:
use Concrete\Core\Tree\Type\Topic as TopicTree;
public $category = array('');
public function view() {
    $tt = new TopicTree();  
    $tree = $tt->getByName('My Categories');  
    $node = $tree->getRootTreeNodeObject();  
    if (is_object($node)) {  
        foreach($node->getChildNodes() as $key => $category) {  
            if ($category instanceof \Concrete\Core\Tree\Node\Type\Topic) {  
                $this->category[$category->getTreeNodeDisplayName()] = $category->getTreeNodeDisplayName();