feat: extract bookmarks as standalone module with MintyPHP\Module\Bookmarks namespace
Moves bookmarks from core hardcoding into modules/bookmarks/ as a
fully self-contained module, following the same pattern as addressbook.
Module contributions via platform slots:
- aside.tab_panel: bookmark sidebar panel
- topbar.right_item: bookmark toggle button
- layout.body_end_template: bookmark/group dialogs
- layout.head_style: bookmark CSS (form + sidebar)
- runtime.component: bookmark-save and bookmark-panel (phase: late)
- search.resource_item: bookmarks in global search (user-scoped via {{userId}})
Backend fully in module namespace (MintyPHP\Module\Bookmarks\*):
- Service: BookmarkService, BookmarkServicesFactory, BookmarkRepositoryFactory
- Repository: BookmarkRepository, BookmarkGroupRepository, BookmarkNavigationRepository
- Support: BookmarkUrlNormalizer
- Providers: BookmarksSessionProvider, BookmarksLayoutProvider, BookmarksSearchProvider
Core cleanup:
- Removed all bookmark-specific markup from core templates
- Removed core DI registrations for bookmark services
- Removed core bookmark pages, JS, CSS
- AuthSessionTenantContextService delegates to module SessionProvider
Architecture guards:
- NoBookmarksHardcodingTest: verifies zero bookmark references in core
- testModuleClassesUseModuleNamespace: prevents core namespace leakage
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
136
modules/bookmarks/module.php
Normal file
136
modules/bookmarks/module.php
Normal file
@@ -0,0 +1,136 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Bookmarks module manifest.
|
||||
*
|
||||
* Owns bookmark routes, topbar/aside/dialog UI, runtime components,
|
||||
* and bookmark session/layout providers.
|
||||
*/
|
||||
return [
|
||||
'id' => 'bookmarks',
|
||||
'version' => '1.0.0',
|
||||
'enabled_by_default' => true,
|
||||
'load_order' => 20,
|
||||
|
||||
'routes' => [
|
||||
['path' => 'bookmarks/save-data', 'target' => 'bookmarks/save-data'],
|
||||
['path' => 'bookmarks/update-data', 'target' => 'bookmarks/update-data'],
|
||||
['path' => 'bookmarks/delete-data', 'target' => 'bookmarks/delete-data'],
|
||||
['path' => 'bookmarks/group-save-data', 'target' => 'bookmarks/group-save-data'],
|
||||
['path' => 'bookmarks/group-delete-data', 'target' => 'bookmarks/group-delete-data'],
|
||||
['path' => 'bookmarks/reorder-data', 'target' => 'bookmarks/reorder-data'],
|
||||
],
|
||||
'public_paths' => [],
|
||||
|
||||
'container_registrars' => [
|
||||
\MintyPHP\Module\Bookmarks\BookmarksContainerRegistrar::class,
|
||||
],
|
||||
|
||||
'ui_slots' => [
|
||||
'aside.tab_panel' => [
|
||||
[
|
||||
'key' => 'bookmarks',
|
||||
'label' => 'Bookmarks',
|
||||
'icon' => 'bi-bookmark-star',
|
||||
'href' => '',
|
||||
'permission' => 'can_use_bookmarks',
|
||||
'panel_template' => __DIR__ . '/templates/aside-bookmarks-panel.phtml',
|
||||
'details_storage' => 'aside-bookmarks-groups-v1',
|
||||
'order' => 120,
|
||||
],
|
||||
],
|
||||
'topbar.right_item' => [
|
||||
[
|
||||
'key' => 'bookmarks-toggle',
|
||||
'template' => __DIR__ . '/templates/topbar-bookmark-button.phtml',
|
||||
'permission' => 'can_use_bookmarks',
|
||||
'order' => 120,
|
||||
],
|
||||
],
|
||||
'layout.body_end_template' => [
|
||||
[
|
||||
'key' => 'bookmarks-dialogs',
|
||||
'template' => __DIR__ . '/templates/bookmark-dialogs.phtml',
|
||||
'permission' => 'can_use_bookmarks',
|
||||
'order' => 120,
|
||||
],
|
||||
],
|
||||
'layout.head_style' => [
|
||||
[
|
||||
'key' => 'bookmarks-form-style',
|
||||
'path' => 'modules/bookmarks/css/components/app-bookmark-form.css',
|
||||
'permission' => 'can_use_bookmarks',
|
||||
'order' => 120,
|
||||
],
|
||||
[
|
||||
'key' => 'bookmarks-aside-style',
|
||||
'path' => 'modules/bookmarks/css/layout/app-sidebar-bookmarks.css',
|
||||
'permission' => 'can_use_bookmarks',
|
||||
'order' => 121,
|
||||
],
|
||||
],
|
||||
'search.resource_item' => [
|
||||
[
|
||||
'key' => 'bookmarks',
|
||||
'label' => 'Bookmarks',
|
||||
'base_url' => '#',
|
||||
'permission' => 'can_use_bookmarks',
|
||||
'order' => 130,
|
||||
],
|
||||
],
|
||||
'runtime.component' => [
|
||||
[
|
||||
'key' => 'bookmark-save',
|
||||
'script' => 'modules/bookmarks/js/components/app-bookmark-save.js',
|
||||
'export' => 'initBookmarkSave',
|
||||
'scope' => 'global',
|
||||
'config_path' => 'components.bookmarkSave',
|
||||
'default_config' => [
|
||||
'openButtonSelector' => '[data-bookmark-open-dialog]',
|
||||
'dialogSelector' => '[data-app-bookmark-dialog]',
|
||||
'groupDialogSelector' => '[data-app-bookmark-group-dialog]',
|
||||
],
|
||||
'phase' => 'late',
|
||||
'permission' => 'can_use_bookmarks',
|
||||
'order' => 120,
|
||||
],
|
||||
[
|
||||
'key' => 'bookmark-panel',
|
||||
'script' => 'modules/bookmarks/js/components/app-bookmark-panel.js',
|
||||
'export' => 'initBookmarkPanel',
|
||||
'selector' => '[data-app-bookmark-panel]',
|
||||
'config_path' => 'components.bookmarkPanel',
|
||||
'default_config' => [
|
||||
'selector' => '[data-app-bookmark-panel]',
|
||||
],
|
||||
'phase' => 'late',
|
||||
'permission' => 'can_use_bookmarks',
|
||||
'order' => 121,
|
||||
],
|
||||
],
|
||||
],
|
||||
|
||||
'authorization_policies' => [
|
||||
\MintyPHP\Module\Bookmarks\BookmarksAuthorizationPolicy::class,
|
||||
],
|
||||
|
||||
'layout_capabilities' => [
|
||||
'can_use_bookmarks' => 'bookmarks.use',
|
||||
],
|
||||
|
||||
'search_resources' => [
|
||||
\MintyPHP\Module\Bookmarks\Providers\BookmarksSearchProvider::class,
|
||||
],
|
||||
'asset_groups' => [],
|
||||
'scheduler_jobs' => [],
|
||||
|
||||
'layout_context_providers' => [
|
||||
\MintyPHP\Module\Bookmarks\Providers\BookmarksLayoutProvider::class,
|
||||
],
|
||||
'session_providers' => [
|
||||
\MintyPHP\Module\Bookmarks\Providers\BookmarksSessionProvider::class,
|
||||
],
|
||||
|
||||
'permissions' => [],
|
||||
'migrations_path' => null,
|
||||
];
|
||||
Reference in New Issue
Block a user