protected function onInitialize() { parent::onInitialize(); $me = $this; //@todo add the type hint back into the closure when the serializer can handle them $this->add(new ListView("tab", function ($item) use($me) { $tab = $item->getModelObject(); $link = $me->newLink('link', $item->getIndex()); if ($me->getSelectedTab() == $item->getIndex()) { $item->add(new \picon\AttributeAppender('class', new \picon\BasicModel('selected'), ' ')); } $item->add($link); $link->add(new \picon\Label('name', new \picon\BasicModel($tab->name))); }, new ArrayModel($this->collection->tabs))); }