/
account_menu.php
51 lines (45 loc) · 1.35 KB
/
account_menu.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
<?php
namespace Concrete\Controller\Element\Navigation;
use Concrete\Core\Controller\ElementController;
use Concrete\Core\Entity\Express\Entity;
use Concrete\Core\Page\Page;
use Concrete\Core\Page\PageList;
class AccountMenu extends Menu
{
public function __construct(Page $currentPage)
{
$dashboard = \Page::getByPath('/account');
$this->setTitle(t('My Account'));
$this->setWrapperClass('ccm-page-account-navigation');
parent::__construct($dashboard, $currentPage);
}
public function displayChildPages(Page $page)
{
$display = parent::displayChildPages($page);
if ($display) {
return true;
} else {
if (
strpos($this->currentPage->getCollectionPath(), '/account/welcome') === 0
) {
return true;
}
}
}
protected function getPageList($parent)
{
$list = parent::getPageList($parent);
$list->includeSystemPages();
return $list;
}
public function getChildPages($parent)
{
$pages = array();
if ($parent->getCollectionPath() == '/account') {
// Add My Account to the List
$pages[] = Page::getByPath('/account/welcome');
}
$pages = array_merge($pages, parent::getChildPages($parent));
return $pages;
}
}