mirror of
https://github.com/Vateron-Media/XC_VM.git
synced 2026-10-06 20:02:37 +02:00
Overhaul the Docsify documentation (English + Russian) so it matches the current codebase and follows one consistent pattern. Content accuracy (post-migration): - Rewrite development/autoloader.md to PSR-4 / Composer (the old XC_Autoloader scanner, igbinary tmp/cache/autoload_map and registerDirectories are gone). - PascalCase every source path (src/core -> src/Core, domain/Stream, cli/Commands, public/Controllers, Infrastructure/Redis, ...) across all docs. - Replace the removed autoload.php references with vendor/autoload.php (build_system, bootstrap-contexts, error-handling, modules). - ssl-generation: note that the installer now auto-generates a unique self-signed certificate before Nginx starts. Common pattern (Clean & uniform): - Strip emoji from headings; remove the in-page Navigation blocks (the Docsify sidebar already provides navigation). - One H1 + intro per doc; uniform "Related files" / "Связанные файлы" section, added to the code-centric docs that lacked it. Structure: - Remove the empty stray docs/api/; move updates_checklist.md into builds/; link the previously-orphaned ucs-integration.md. - Regroup the sidebars (split the oversized guides group into Developer Guides / Security & Access / Integrations; fold builds into Build & Release). Augment: - dev-workflow: Local Setup (make dev-tools) + Quality Checks (phpstan, cs, gates). - build_system: Composer Dependencies section (committed prod-only vendor, committed lock, dev tools via composer install, no build-time vendor step). en/ru parity: - Apply the same structure, fixes and pattern to docs/ru/ (translated), including a new Russian ucs-integration.md. The en and ru file sets are now identical.
4.0 KiB
4.0 KiB
Рендер navbar в панели модулей
Техническая документация по формированию и рендерингу navbar в админ-панели.
Назначение
Navbar строится декларативно из дерева NavbarItem, а не из hardcoded HTML-меню.
Источник дерева:
- Core-узлы из
CoreNavbarProvider::register(). - Модульные узлы из
ModuleInterface::registerNavbar().
Жизненный цикл
ModuleLoader::bootAll()вызываетCoreNavbarProvider::register().- Затем для каждого загруженного модуля вызывается
registerNavbar(). - В
Public/Views/admin/header.phpдерево рендерится изNavbarRegistry.
Рендер в header
Рендер выполняется helper-функциями:
_xc_nav_visible()— фильтрация видимости узла._xc_nav_label()— получение текстовой подписи._xc_nav_children()— рекурсивный вывод дочерних пунктов.
Верхний уровень берётся через NavbarRegistry::getTopLevel(), дочерние узлы — через NavbarRegistry::getChildren($key).
Правила видимости
Проверки выполняются в _xc_nav_visible():
desktopOnly: скрывает узел на мобильных.settingDisabled: скрывает узел при включённом settings-флаге.permissions: OR-проверка черезAuthorization::check('adv', $permission).- Группа с
url='#'показывается только если есть хотя бы один видимый потомок. dividerвсегда пропускается в рендер как разделитель.
Особенности рендера
dividerвыводится как разделитель без ссылки.submenuClass('megamenu')включает двухколоночный вывод длинных списков.noMobileSubmenuвыключает раскрытие дочернего меню на мобильных.
Как модулю добавить кнопку
Модуль добавляет пункты только через registerNavbar():
public function registerNavbar(): void {
NavbarRegistry::add((new NavbarItem('management.service_setup.my_module'))
->parent('management.service_setup')
->url('my_module')
->label('my_module')
->permissions(['my_module'])
->order(60));
NavbarRegistry::add((new NavbarItem('management.logs.my_module_log'))
->parent('management.logs')
->url('my_module_logs')
->label('', 'My Module Logs')
->permissions(['my_module'])
->order(170));
}
Практические правила для модулей
- Используйте уникальные
keyв форматеsection.group.item. - Указывайте существующий
parentиз core-дерева или своего уже добавленного узла. - Позиционируйте пункты через
orderвнутри одного parent. - Используйте
label('translation_key')для переводимых строк. - Используйте
label('', 'Literal Text')для фиксированного текста. - Если модуль не добавляет меню, оставляйте
registerNavbar()пустым.
Связанные файлы
| Файл | Роль |
|---|---|
src/Core/Module/NavbarRegistry.php |
Собирает пункты navbar от провайдеров |
src/Core/Module/NavbarItem.php |
Value-объект пункта navbar |
src/Core/Module/CoreNavbarProvider.php |
Встроенные пункты меню ядра |
src/Public/Views/admin/header.php |
Рендерит дерево navbar |