feat: extend module platform with UI slots, runtime components, CLI tooling and {{userId}} search support
Completes the generic module platform that enables modules to contribute
UI elements, runtime JS components, and search resources without any
core hardcoding.
New generic UI slot types:
- topbar.right_item: module-contributed topbar buttons
- layout.body_end_template: module-contributed dialog/overlay templates
- layout.head_style: module-contributed global CSS
- runtime.component: declarative JS component registration with phase ordering
New infrastructure:
- ModuleAutoloader: PSR-4 autoloading for module-local PHP classes
- ModuleRuntimePageBuilder: symlinks module pages into runtime directory
- ModuleRuntimeAssetPublisher: publishes module CSS/JS to web/modules/
- ModulePermissionSynchronizer: syncs module permissions to DB
- CLI scripts: module-runtime-sync, module-build, module-migrate,
module-permissions-sync, module-assets-sync
- {{userId}} placeholder in SearchDataService for user-scoped search queries
- Component runtime with phased initialization (early/default/late)
- AppContainer.protectExistingBindings() to prevent module→core overwrites
- Architecture tests: ModuleStructureContractTest, CoreTemplateIsolationTest,
FrontendComponentRuntimeContractTest, AppContainerIsolationContractTest
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -16,7 +16,6 @@ $currentUserId = (int) ($_SESSION['user']['id'] ?? 0);
|
||||
$isOwnAccount = $currentUserId > 0 && $currentUserId === (int) ($values['id'] ?? 0);
|
||||
$titleText = $isOwnAccount ? t('My account') : t('Edit user');
|
||||
$canViewUsers = !empty($canViewUsers);
|
||||
$canViewAddressBook = !empty($canViewAddressBook);
|
||||
$canViewUserMeta = !empty($canViewUserMeta);
|
||||
$canViewUserAudit = !empty($canViewUserAudit);
|
||||
$canAccessPdf = !empty($canAccessPdf);
|
||||
@@ -58,11 +57,56 @@ if ($lastLoginAt !== '') {
|
||||
<?php endif; ?>
|
||||
<?php
|
||||
$asideActions = [];
|
||||
if ($canViewAddressBook) {
|
||||
$moduleSlots = is_array($layoutNav['moduleSlots'] ?? null) ? $layoutNav['moduleSlots'] : [];
|
||||
$moduleAsideActionSlots = is_array($moduleSlots['user.edit.aside_action'] ?? null) ? $moduleSlots['user.edit.aside_action'] : [];
|
||||
$slotContextMap = [
|
||||
'{user_id}' => (string) ($values['id'] ?? ''),
|
||||
'{user_uuid}' => (string) ($values['uuid'] ?? ''),
|
||||
];
|
||||
foreach ($moduleAsideActionSlots as $slotAction) {
|
||||
if (!is_array($slotAction)) {
|
||||
continue;
|
||||
}
|
||||
$slotPermission = trim((string) ($slotAction['permission'] ?? ''));
|
||||
if ($slotPermission !== '' && empty($layoutAuth[$slotPermission])) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$slotLabel = trim((string) ($slotAction['label'] ?? ''));
|
||||
if ($slotLabel === '') {
|
||||
continue;
|
||||
}
|
||||
$slotType = trim((string) ($slotAction['type'] ?? 'link'));
|
||||
if ($slotType === 'form') {
|
||||
$slotFormAction = trim((string) ($slotAction['action'] ?? ''));
|
||||
if ($slotFormAction === '') {
|
||||
continue;
|
||||
}
|
||||
$slotFormAction = strtr($slotFormAction, $slotContextMap);
|
||||
if (!str_starts_with($slotFormAction, '/') && !str_starts_with($slotFormAction, 'http://') && !str_starts_with($slotFormAction, 'https://')) {
|
||||
$slotFormAction = lurl($slotFormAction);
|
||||
}
|
||||
$asideActions[] = [
|
||||
'type' => 'form',
|
||||
'method' => strtoupper(trim((string) ($slotAction['method'] ?? 'POST'))),
|
||||
'action' => $slotFormAction,
|
||||
'label' => t($slotLabel),
|
||||
];
|
||||
continue;
|
||||
}
|
||||
|
||||
$slotHref = trim((string) ($slotAction['href'] ?? ''));
|
||||
if ($slotHref === '') {
|
||||
continue;
|
||||
}
|
||||
$slotHref = strtr($slotHref, $slotContextMap);
|
||||
if (!str_starts_with($slotHref, '/') && !str_starts_with($slotHref, 'http://') && !str_starts_with($slotHref, 'https://')) {
|
||||
$slotHref = lurl($slotHref);
|
||||
}
|
||||
$asideActions[] = [
|
||||
'type' => 'link',
|
||||
'href' => lurl('address-book/view/' . ($values['uuid'] ?? '')),
|
||||
'label' => t('View in address book'),
|
||||
'href' => $slotHref,
|
||||
'label' => t($slotLabel),
|
||||
];
|
||||
}
|
||||
if ($canEditUser) {
|
||||
|
||||
Reference in New Issue
Block a user