igfs/kernel/modules/menu/MenuModule.php
2024-09-23 17:03:42 +03:00

34 lines
668 B
PHP

<?php
namespace kernel\modules\menu;
use kernel\Module;
use kernel\modules\menu\service\MenuService;
class MenuModule extends Module
{
public MenuService $menuService;
public function __construct()
{
$this->menuService = new MenuService();
}
/**
* @throws \Exception
*/
public function init(): void
{
$this->menuService->createItem([
"label" => "Меню",
"url" => "/admin/settings/menu",
"slug" => "menu",
"parent_slug" => "settings"
]);
}
public function deactivate(): void
{
$this->menuService->removeItemBySlug("menu");
}
}