Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions src/Controller/AddonsController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?php

/*
* This file is part of the Tabler-Bundle demo.
* Copyright 2021 Kevin Papst - www.kevinpapst.de
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace App\Controller;

use App\Service\TablerService;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Attribute\Route;

class AddonsController extends AbstractController
{
#[Route('/flags', name: 'addons_flags')]
public function icons(TablerService $tablerService): Response
{
return $this->render('addons/flags.html.twig', [
'flags' => $tablerService->flags(),
]);
}
}
6 changes: 6 additions & 0 deletions src/EventSubscriber/MenuBuilderSubscriber.php
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,12 @@ public function onSetupNavbar(MenuEvent $event): void
$docu->setBadgeColor('blue');
$event->addItem($docu);

$addons = new MenuItemModel('addons', 'Addons');
$addons->addChild(
new MenuItemModel('flags', 'Flags', 'addons_flags')
);
$event->addItem($addons);

if (!$this->security->isGranted('IS_AUTHENTICATED')) {
$event->addItem(
new MenuItemModel('login', 'login', 'security_login', [], 'fas fa-sign-in-alt')
Expand Down
34 changes: 34 additions & 0 deletions src/Model/TablerFlag.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?php

/*
* This file is part of the Tabler-Bundle demo.
* Copyright 2021 Kevin Papst - www.kevinpapst.de
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace App\Model;

use Symfony\Component\Serializer\Attribute\SerializedName;

final class TablerFlag
{
public function __construct(
#[SerializedName('name')]
private readonly string $name,
#[SerializedName('flag')]
private readonly string $flag,
) {
}

public function getName(): string
{
return $this->name;
}

public function getFlag(): string
{
return $this->flag;
}
}
Loading