public function collectItems(CollectItemsEvent $event) { $item = $event->getParentItem(); if ($item->getType() == 'page') { if (empty($this->columns)) { return; } $columnWildcards = array_fill(0, count($this->columns), '?'); $columnWildcards = implode(',', $columnWildcards); $t = \ArticleModel::getTable(); $arrColumns = array("{$t}.pid=?", "{$t}.inColumn IN ({$columnWildcards})"); if (!BE_USER_LOGGED_IN) { $time = time(); $arrColumns[] = "({$t}.start='' OR {$t}.start<{$time}) AND ({$t}.stop='' OR {$t}.stop>{$time}) AND {$t}.published=1"; } $articles = \ArticleModel::findBy($arrColumns, array_merge(array($item->getName()), $this->columns), array('order' => 'sorting')); if ($articles) { $factory = $event->getFactory(); foreach ($articles as $article) { $factory->createItem('article', $article->id, $item); } } } }