public function provideGridListItems() { $results = new \ArrayList(); /** @var Service $service */ $service = \Injector::inst()->get('SearchService'); if ($tags = array_filter(explode(',', $service->constraint(Constraints::TagsVar)))) { $allTags = Tag::get(); $searchClasses = $this->config()->get('search_classes'); foreach ($tags as $tag) { /** @var ModelTag $tag */ if ($tag = $allTags->find(ModelTag::field_name(), $tag)) { // merge all related classes that end in 'Page' for this tag $results->merge($tag->relatedByClassName($searchClasses)); } } } return $results; }
protected function availableTags() { return Tag::get()->sort('Title'); }