chg: [Navigationcomponent] added missing changes from previous commit
parent
4b5bccae28
commit
b7facf226d
|
@ -17,8 +17,9 @@ require_once(APP . 'Controller' . DS . 'Component' . DS . 'Navigation' . DS . 's
|
||||||
|
|
||||||
class NavigationComponent extends Component
|
class NavigationComponent extends Component
|
||||||
{
|
{
|
||||||
private $user = null;
|
private $currentUser = null;
|
||||||
public $breadcrumb = null;
|
public $breadcrumb = null;
|
||||||
|
public $fullBreadcrumb = null;
|
||||||
public $iconToTableMapping = [
|
public $iconToTableMapping = [
|
||||||
'Individuals' => 'address-book',
|
'Individuals' => 'address-book',
|
||||||
'Organisations' => 'building',
|
'Organisations' => 'building',
|
||||||
|
@ -42,10 +43,10 @@ class NavigationComponent extends Component
|
||||||
$this->request = $config['request'];
|
$this->request = $config['request'];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function beforeFilter($event)
|
public function genBreadcrumbs(\App\Model\Entity\User $user)
|
||||||
{
|
{
|
||||||
$this->fullBreadcrumb = $this->genBreadcrumb();
|
$this->currentUser = $user;
|
||||||
$this->breadcrumb = $this->getBreadcrumb();
|
$this->breadcrumb = $this->fullBreadcrumb = $this->genBreadcrumb();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getSideMenu(): array
|
public function getSideMenu(): array
|
||||||
|
@ -56,7 +57,7 @@ class NavigationComponent extends Component
|
||||||
return $sidemenu;
|
return $sidemenu;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public function addUserBookmarks($sidemenu): array
|
public function addUserBookmarks($sidemenu): array
|
||||||
{
|
{
|
||||||
$bookmarks = $this->getUserBookmarks();
|
$bookmarks = $this->getUserBookmarks();
|
||||||
|
@ -81,7 +82,7 @@ class NavigationComponent extends Component
|
||||||
}, $bookmarks);
|
}, $bookmarks);
|
||||||
return $links;
|
return $links;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getBreadcrumb(): array
|
public function getBreadcrumb(): array
|
||||||
{
|
{
|
||||||
$controller = $this->request->getParam('controller');
|
$controller = $this->request->getParam('controller');
|
||||||
|
@ -141,6 +142,7 @@ class NavigationComponent extends Component
|
||||||
require_once(APP . 'Controller' . DS . 'Component' . DS . 'Navigation' . DS . $navigationFile);
|
require_once(APP . 'Controller' . DS . 'Component' . DS . 'Navigation' . DS . $navigationFile);
|
||||||
$reflection = new \ReflectionClass("BreadcrumbNavigation\\{$navigationClassname}Navigation");
|
$reflection = new \ReflectionClass("BreadcrumbNavigation\\{$navigationClassname}Navigation");
|
||||||
$navigationClasses[$navigationClassname] = $reflection->newInstance($bcf, $request);
|
$navigationClasses[$navigationClassname] = $reflection->newInstance($bcf, $request);
|
||||||
|
$navigationClasses[$navigationClassname]->setCurrentUser($this->currentUser);
|
||||||
}
|
}
|
||||||
return $navigationClasses;
|
return $navigationClasses;
|
||||||
}
|
}
|
||||||
|
@ -284,7 +286,7 @@ class BreadcrumbFactory
|
||||||
$this->addLink($controller, 'view', $controller, 'edit');
|
$this->addLink($controller, 'view', $controller, 'edit');
|
||||||
$this->addLink($controller, 'edit', $controller, 'view');
|
$this->addLink($controller, 'edit', $controller, 'view');
|
||||||
$this->addSelfLink($controller, 'edit');
|
$this->addSelfLink($controller, 'edit');
|
||||||
|
|
||||||
$this->addAction($controller, 'view', $controller, 'add');
|
$this->addAction($controller, 'view', $controller, 'add');
|
||||||
$this->addAction($controller, 'view', $controller, 'delete');
|
$this->addAction($controller, 'view', $controller, 'delete');
|
||||||
$this->addAction($controller, 'edit', $controller, 'add');
|
$this->addAction($controller, 'edit', $controller, 'add');
|
||||||
|
|
Loading…
Reference in New Issue