From 5280386d51f384e1dc2643a64daecf4eabcd43f9 Mon Sep 17 00:00:00 2001 From: wangzemei Date: Mon, 24 Mar 2025 15:21:29 +0800 Subject: [PATCH] * [story#72666] support icons for secondary menus. --- lib/zin/wg/navbar/v1.php | 4 +++- module/custom/model.php | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/zin/wg/navbar/v1.php b/lib/zin/wg/navbar/v1.php index 4c5e2fd10c..8494c45898 100644 --- a/lib/zin/wg/navbar/v1.php +++ b/lib/zin/wg/navbar/v1.php @@ -187,6 +187,7 @@ class navbar extends wg 'text' => $menuItem->text, 'type' => 'text', 'tagName' => 'span', + 'icon' => isset($menuItem->icon) ? $menuItem->icon : '', ); continue; @@ -326,6 +327,7 @@ class navbar extends wg { $items[] = array( 'class' => $class, + 'icon' => isset($menuItem->icon) ? $menuItem->icon : '', 'text' => $label, 'url' => commonModel::createMenuLink($menuItem, $tab), 'active' => $isActive, @@ -338,7 +340,7 @@ class navbar extends wg } else { - $items[] = array('class' => $class, 'text' => $menuItem->text, 'active' => $isActive); + $items[] = array('class' => $class, 'icon' => isset($menuItem->icon) ? $menuItem->icon : '', 'text' => $menuItem->text, 'active' => $isActive); } } diff --git a/module/custom/model.php b/module/custom/model.php index 09b8888997..ed8e1471f2 100644 --- a/module/custom/model.php +++ b/module/custom/model.php @@ -188,10 +188,11 @@ class customModel extends model list($customMenuMap, $order) = static::buildCustomMenuMap($allMenu, $customMenu, $module); /* Merge fileMenu && customMenu. */ - foreach($customMenuMap as $name => $item) + foreach($customMenuMap as $name => &$item) { if(is_object($allMenu) && !isset($allMenu->{$name})) $allMenu->{$name} = $item; if(is_array($allMenu) && !isset($allMenu[$name])) $allMenu[$name] = $item; + if(is_object($allMenu) && isset($allMenu->{$name}) && isset($allMenu->{$name}['icon'])) $item->icon = $allMenu->{$name}['icon']; } $menu = static::buildMenuItems($allMenu, $customMenuMap, $module, $order); @@ -419,6 +420,7 @@ class customModel extends model $menuItem->link = $itemLink; $menuItem->text = $label; if($isTutorialMode) $menuItem->tutorial = true; + if(isset($customMenuMap[$name]) && isset($customMenuMap[$name]->icon)) $menuItem->icon = $customMenuMap[$name]->icon; $attrList = array('class', 'subModule', 'dropMenu', 'alias', 'exclude', 'divider'); $hidden = strpos($name, 'QUERY') === 0 && !isset($customMenuMap[$name]) ? false : isset($customMenuMap[$name]) && isset($customMenuMap[$name]->hidden) && $customMenuMap[$name]->hidden;