WIP: Implement admin CRUD
This commit is contained in:
1 parent
3e0353c79b
commit
c55fd85314
63 files changed
+1367
-532
No files matched your search
@@ -20,17 +20,9 @@ abstract class AbstractMenuBuilder
|
||||
) {
|
||||
}
|
||||
|
||||
protected function assertMobile(array $options): bool
|
||||
protected function createRootElement(): ItemInterface
|
||||
{
|
||||
return isset($options['mobile']) && true === (bool) $options['mobile'];
|
||||
}
|
||||
|
||||
protected function createRootElement(string $class): ItemInterface
|
||||
{
|
||||
return $this
|
||||
->factory->createItem('root')
|
||||
->setChildrenAttribute('class', $class)
|
||||
;
|
||||
return $this->factory->createItem('root');
|
||||
}
|
||||
|
||||
protected function getDefaultRouteParameters(string $parameter = 'id', string $default = '0'): array
|
||||
@@ -38,7 +30,40 @@ abstract class AbstractMenuBuilder
|
||||
return [$parameter => $this->requestStack->getMainRequest()->get($parameter, $default)];
|
||||
}
|
||||
|
||||
protected function addLogoutItem(ItemInterface $menu, bool $isMobile = false): void
|
||||
protected function addAdminItem(ItemInterface $menu): void
|
||||
{
|
||||
if ($this->security->isGranted('ROLE_ADMIN')) {
|
||||
$menu
|
||||
->addChild('Adminbereich', ['route' => 'app_admin_index'])
|
||||
->setChildrenAttribute('title', 'Adminbereich')
|
||||
->setExtra('icon', 'user')
|
||||
;
|
||||
}
|
||||
}
|
||||
|
||||
protected function addManagerItem(ItemInterface $menu): void
|
||||
{
|
||||
if ($this->security->isGranted('ROLE_MANAGER')) {
|
||||
$menu
|
||||
->addChild('Managerbereich', ['route' => 'app_manager_index'])
|
||||
->setChildrenAttribute('title', 'Managerbereich')
|
||||
->setExtra('icon', 'user')
|
||||
;
|
||||
}
|
||||
}
|
||||
|
||||
protected function addTeamerItem(ItemInterface $menu): void
|
||||
{
|
||||
if ($this->security->isGranted('ROLE_TEAMER')) {
|
||||
$menu
|
||||
->addChild('Teamerbereich', ['route' => 'app_teamer_index'])
|
||||
->setChildrenAttribute('title', 'Teamerbereich')
|
||||
->setExtra('icon', 'user')
|
||||
;
|
||||
}
|
||||
}
|
||||
|
||||
protected function addLogoutItem(ItemInterface $menu): void
|
||||
{
|
||||
$token = $this->security->getToken();
|
||||
|
||||
@@ -55,19 +80,20 @@ abstract class AbstractMenuBuilder
|
||||
'class' => 'icon-link',
|
||||
])
|
||||
->setExtra('icon', 'logout')
|
||||
->setExtra('icon_only', false === $isMobile)
|
||||
;
|
||||
} else {
|
||||
$menu
|
||||
->addChild('Logout', ['route' => 'app_security_logout'])
|
||||
->setLinkAttributes([
|
||||
'title' => 'Logout',
|
||||
'class' => 'icon-link',
|
||||
])
|
||||
->setExtra('icon', 'logout')
|
||||
->setExtra('icon_only', false === $isMobile)
|
||||
;
|
||||
}
|
||||
}
|
||||
|
||||
protected function addDivider(ItemInterface $menu): void
|
||||
{
|
||||
$menu->addChild('%DIVIDER%');
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user