Source of file BoltBlogCategory.php
Size: 0,921 Bytes - Last Modified: 2021-12-24T06:39:34+00:00
/var/www/docs.ssmods.com/process/src/code/extensions/BoltBlogCategory.php
1234567891011121314151617181920212223242526272829303132333435363738394041 | <?php /* Adds a linkingmode function for simple highlighting of the current category */ class BoltBlogCategory extends DataExtension{ function BlogLink() { if (empty($this->owner->BlogID)) { $entry = Director::get_current_page(); if (is_a($entry, 'BlogPost')) { $this->owner->BlogID = $entry->Parent()->ID; } else if (is_a($entry, 'Blog')) { $this->owner->BlogID = $entry->ID; } else { $this->owner->BlogID = Blog::get()->First()->ID; } } return Blog::get()->byId($this->owner->BlogID)->Link(); } function LinkingMode() { $entry = Director::get_current_page(); if (is_a($entry, 'Blog')) { $currentCategory = Controller::curr()->getCurrentCategory(); if ($currentCategory) { if ($currentCategory->ID == $this->owner->ID) { return 'current'; } } else if (!$this->owner->ID) { // this must be the allcat return 'current'; } } } } |