Concrete220.127.116.11 - topic list getTopicLink() - “illegal offset type” error
it all works fine. But if I use it this way:
$regions[$view->controller->getTopicLink($region)] = $region->getTreeNodeDisplayName(); echo $form->select('regions', $regions);
it gives me an "illegal offset type" error?
And second question - there is a topic list block which shows topic links as link elements <a>, where it filters pages by topics when clicked on the links. But how can I do the same filtering if I want to have the topic list as a selectbox element? So when I select an option from the select box, it should filter the pages as the default one does.
$regions[ (string) $view->controller->getTopicLink($region)] =$region->getTreeNodeDisplayName();
Most likely getTopicLink is returning an object. In the simple case of echo, you're getting the right thing happen because the magic __toString() method is being run. In the other case, it's not because you're making an assignment, thus you're trying to use an object as an array index which is illegal hence the warning. Casting to string ensures you're using string data as the array index.