123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134 |
- <?php
- namespace Ppb\Navigation\Page;
- use Cube\Navigation\Page\AbstractPage,
- Cube\Controller\Front;
- class ContentSection extends AbstractPage
- {
-
- protected $_sectionId;
-
- protected $_slug;
-
- public function setSectionId($sectionId)
- {
- $this->_sectionId = $sectionId;
- return $this;
- }
-
- public function getSectionId()
- {
- if (!$this->_sectionId) {
- $this->setSectionId(
- Front::getInstance()->getRequest()->getParam('id'));
- }
- return $this->_sectionId;
- }
-
- public function setSlug($slug)
- {
- $this->_slug = $slug;
- return $this;
- }
-
- public function getSlug()
- {
- return $this->_slug;
- }
-
- public function get($name)
- {
- if ($name == 'params' && !empty($this->_slug)) {
- return $this->getSlug();
- }
- return parent::get($name);
- }
-
- public function isActive($recursive = false)
- {
- if (!$this->_active) {
- if ($this->getSectionId() == $this->_id) {
- $this->_active = true;
- return true;
- }
- }
- return parent::isActive($recursive);
- }
- }
|