2024-09-12 16:01:04 +03:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace kernel\modules\menu;
|
|
|
|
|
|
|
|
use kernel\Module;
|
2024-09-23 17:03:42 +03:00
|
|
|
use kernel\modules\menu\service\MenuService;
|
2024-09-12 16:01:04 +03:00
|
|
|
|
|
|
|
class MenuModule extends Module
|
|
|
|
{
|
|
|
|
|
2024-09-23 17:03:42 +03:00
|
|
|
public MenuService $menuService;
|
|
|
|
public function __construct()
|
2024-09-12 16:01:04 +03:00
|
|
|
{
|
2024-09-23 17:03:42 +03:00
|
|
|
$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");
|
2024-09-12 16:01:04 +03:00
|
|
|
}
|
|
|
|
}
|