public function getBlogCategoriesMoreLink() { if (Config::inst()->get('BlogCategory', 'limit_to_holder')) { $parent = $this->owner->Parent(); } else { $parent = BlogTree::get()->filter('ClassName', 'BlogTree')->First(); if (!$parent) { $parent = BlogHolder::get()->First(); } } return $parent->Link('categoryindex'); }
/** * @return BlogHolder */ protected function getHolder($record) { $filter = new URLSegmentFilter(); $urlSegment = $filter->filter($record['blog_path']); $tree = $this->_cache_tree; if (!$tree) { $tree = BlogTree::get()->filter(array('Title' => 'Blogs'))->First(); if (!$tree) { $tree = new BlogTree(array('Title' => 'Blogs', 'ParentID' => $this->parentId)); $tree->write(); if ($this->publish) { $tree->publish('Stage', 'Live'); } } $this->_cache_tree = $tree; } $holder = isset($this->_cache_holders[$urlSegment]) ? $this->_cache_holders[$urlSegment] : null; if (!$holder) { $holder = BlogHolder::get()->filter(array('URLSegment' => $urlSegment, 'ParentID' => $tree->ID))->First(); if (!$holder) { $holder = new BlogHolder(array('Title' => $record['blog_title'], 'URLSegment' => $urlSegment, 'ParentID' => $tree->ID)); $holder->write(); if ($this->publish) { $holder->publish('Stage', 'Live'); } } $this->_cache_holders[$urlSegment] = $holder; } return $holder; }