feat: add icon overrides for all Moko components in admin menu
Parent icons from catalog.xml, child icons auto-guessed from view name (dashboard, contacts, orders, etc.) with fallback to angle-right. Claude-Session: https://claude.ai/code/session_01Jo2JpjCwfHAh2HHRSjczKq
This commit is contained in:
@@ -38,6 +38,72 @@ $mokosuiteclientStaticViews = array_filter($allViews, function ($v) use ($user,
|
||||
return $isSuper || $user->authorise($v['acl'], 'com_mokosuiteclient');
|
||||
});
|
||||
|
||||
// ── Icon overrides (canonical icons per component) ───────────────────
|
||||
$iconOverrides = [
|
||||
'com_mokosuiteclient' => 'icon-shield-alt',
|
||||
'com_mokosuitehq' => 'icon-tachometer-alt',
|
||||
'com_mokosuitebackup' => 'icon-archive',
|
||||
'com_mokosuitecrm' => 'icon-address-book',
|
||||
'com_mokosuiteerp' => 'icon-briefcase',
|
||||
'com_mokosuiteshop' => 'icon-shopping-cart',
|
||||
'com_mokosuitepos' => 'icon-calculator',
|
||||
'com_mokosuitemrp' => 'icon-cog',
|
||||
'com_mokosuitehrm' => 'icon-users',
|
||||
'com_mokosuiterestaurant' => 'icon-utensils',
|
||||
'com_mokosuitechild' => 'icon-child',
|
||||
'com_mokosuitenpo' => 'icon-heart',
|
||||
'com_mokosuitefield' => 'icon-wrench',
|
||||
'com_mokosuitecreate' => 'icon-paint-brush',
|
||||
'com_mokosuiteforms' => 'icon-list-alt',
|
||||
'com_mokosuitecommunity' => 'icon-users',
|
||||
'com_mokosuitecross' => 'icon-share-alt',
|
||||
'com_mokosuiteopengraph' => 'icon-share-alt',
|
||||
'com_mokosuitestorelocator' => 'icon-map-marker-alt',
|
||||
];
|
||||
|
||||
$childIconMap = [
|
||||
'dashboard' => 'icon-tachometer-alt',
|
||||
'contacts' => 'icon-address-book',
|
||||
'deals' => 'icon-handshake',
|
||||
'activities' => 'icon-clock',
|
||||
'tickets' => 'icon-life-ring',
|
||||
'helpdesk' => 'icon-life-ring',
|
||||
'products' => 'icon-box',
|
||||
'orders' => 'icon-shopping-cart',
|
||||
'invoices' => 'icon-file-invoice',
|
||||
'inventory' => 'icon-warehouse',
|
||||
'settings' => 'icon-cog',
|
||||
'config' => 'icon-cog',
|
||||
'options' => 'icon-sliders-h',
|
||||
'reports' => 'icon-chart-bar',
|
||||
'analytics' => 'icon-chart-line',
|
||||
'locations' => 'icon-map-marker-alt',
|
||||
'stores' => 'icon-store',
|
||||
'categories' => 'icon-folder',
|
||||
'forms' => 'icon-list-alt',
|
||||
'submissions' => 'icon-inbox',
|
||||
'emails' => 'icon-envelope',
|
||||
'campaigns' => 'icon-bullhorn',
|
||||
'users' => 'icon-users',
|
||||
'members' => 'icon-id-card',
|
||||
'employees' => 'icon-id-badge',
|
||||
'donors' => 'icon-hand-holding-heart',
|
||||
'donations' => 'icon-donate',
|
||||
'events' => 'icon-calendar',
|
||||
'tasks' => 'icon-tasks',
|
||||
'projects' => 'icon-project-diagram',
|
||||
'templates' => 'icon-file-alt',
|
||||
'announcements'=> 'icon-bullhorn',
|
||||
'plugins' => 'icon-plug',
|
||||
'import' => 'icon-upload',
|
||||
'export' => 'icon-download',
|
||||
'log' => 'icon-list',
|
||||
'backup' => 'icon-archive',
|
||||
'channels' => 'icon-share-alt',
|
||||
'posts' => 'icon-paper-plane',
|
||||
'schedule' => 'icon-calendar-alt',
|
||||
];
|
||||
|
||||
// ── Auto-discover all Moko components from #__menu ──────────────────
|
||||
$mokoComponents = [];
|
||||
|
||||
@@ -83,21 +149,31 @@ try
|
||||
{
|
||||
if ((int) $m->level === 1)
|
||||
{
|
||||
$icon = $iconOverrides[$m->element]
|
||||
?? str_replace('class:', 'icon-', $m->img ?: 'class:puzzle-piece');
|
||||
$mokoComponents[$m->element] = [
|
||||
'id' => $m->id,
|
||||
'title' => Text::_($m->title),
|
||||
'link' => $m->link,
|
||||
'icon' => str_replace('class:', 'icon-', $m->img ?: 'class:puzzle-piece'),
|
||||
'icon' => $icon,
|
||||
'element' => $m->element,
|
||||
'children' => [],
|
||||
];
|
||||
}
|
||||
elseif ((int) $m->level === 2 && isset($mokoComponents[$m->element]))
|
||||
{
|
||||
$childIcon = str_replace('class:', 'icon-', $m->img ?: '');
|
||||
if ($childIcon === '' || $childIcon === 'icon-cog' || $childIcon === 'icon-cogs')
|
||||
{
|
||||
$parsed = [];
|
||||
parse_str(parse_url($m->link, PHP_URL_QUERY) ?? '', $parsed);
|
||||
$viewKey = strtolower($parsed['view'] ?? '');
|
||||
$childIcon = $childIconMap[$viewKey] ?? '';
|
||||
}
|
||||
$mokoComponents[$m->element]['children'][] = [
|
||||
'title' => Text::_($m->title),
|
||||
'link' => $m->link,
|
||||
'icon' => str_replace('class:', 'icon-', $m->img ?: 'class:cog'),
|
||||
'icon' => $childIcon ?: 'icon-angle-right',
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user