Sugarcrm支持 产品指南 糖开发人员 糖开发人员指南11.0 用户界面 Megamenu.

Megamenu.

概述

Megamenu是位于每个糖页面顶部的标题导航栏。它是用于导航糖应用的前端的主要工具。

 Megamenu.

布局组件

The MegaMenu layout, located in ./clients/base/layouts/header/header.php,  is composed of the 模块-list and  quicksearch layouts as well as the notifications,  profileactions and quickcreate views. To customize these components, you can create your own layout override in ./custom/clients/base/layouts/header/header.php to reference your own custom components.

以下属性定义系统中所有链接的导航,显示和可见性:

名称 描述
ACL_Action. ACL操作用于验证用户是否可以访问链接所需的特定操作
Acl_module. ACL模块用于验证用户是否可以访问链接所需的特定模块
图标 引导标记图标以在链接旁边显示(admin中列出的图标列表> Styleguide > Core Elements > Base CSS > Icons)
标签 包含您的链接显示文本的标签密钥
打开窗户 指定链接是否应在新窗口中打开
路线 The route to direct the user. For sidecar modules, this is #<module>, but modules in backward compatibility mode are routed as #bwc/index.php?module=<module>.
笔记 :外部链接要求完整的URL以及OpenWindow设置为True。
子菜单 一系列子导航链接
笔记 :子导航链接包含这些相同的基本链路属性。

模块链接是每个可用模块的顶级链接,表示为导航栏中的选项卡(或有时,溢出菜单)。单击顶级链接时,用户将针对所选的模块列表视图布局。这些顶级链路也是包含子导航菜单链接的可扩展元素,这些元素在以下部分中概述。

当模块操作链接显示给用户,当它们单击模块链接旁边的向下箭头时。 

模块links

下面的示例演示了如何添加指向Leads模块的模块操作链接。要定义自己的模块操作链接,您必须为链接的显示标签创建自己的标签扩展:

./custom/extension/pplication/ext/language/en_us.addmodulelink.php.

<?php

//create the links label
$app_strings['LNK_LEADS_C'] = 'View Leads';

现在创建模块操作链接扩展:

./custom/extension/modules/<module>/ ext/clients/base/menus/header/addmodulelink.php.

<?php

$viewdefs['<module>']['base']['menu']['header'][] = array(
    'route'=>'#Leads',
    'label' =>'LNK_LEADS_C',
    'acl_module'=>'Leads',
    'icon' => 'icon-user',
);

创建扩展文件后,导航到admin> Repair >快速修复和重建。这将将您的个人资料操作项附加到现有链接列表中。

笔记:  您可能需要刷新页面以查看新配置文件菜单项。

To remove a module action link, loop through the list of module actions and remove the item by one of its properties. For your reference, the stock module actions can be found in ./modules/<module>/clients/base/menus/header/header.php.

./custom/extension/modules/<module>/ ext/clients/base/menus/header/removemodulelink.php.

if (isset($viewdefs['<module>']['base']['menu']['header'])) {
    foreach ($viewdefs['<module>']['base']['menu']['header'] as $key => $moduleAction) {
        //remove the link by label key
        if (in_array($moduleAction['label'], array('<link label key>'))) {
            unset($viewdefs['<module>']['base']['menu']['header'][$key]);
        }
    }
}

创建扩展文件后,导航到admin> Repair >快速修复和重建。这将从现有链接列表中删除菜单操作项。

笔记:  您可能需要刷新页面以查看删除的模块菜单项。

Profile actions are the links listed under the user's profile menu on the right side of the MegaMenu. Profile action extension files are located in ./custom/Extension/application/Ext/clients/base/views/profileactions/ and are compiled into  ./custom/application/Ext/clients/base/views/profileactions/profileactions.ext.php.

 Profilelinks.

下面的示例演示了如何将配置文件操作链接添加到StyleGuide。要定义自己的配置文件操作链接,请为链接的显示标签创建自己的标签扩展名。 

./custom/extension/pplication/ext/language/en_us.addprofileaigtionlink.php.

<?php

//create the links label
$app_strings['LNK_STYLEGUIDE_C'] = 'Styleguide';

接下来,创建配置文件操作链接扩展名:

./custom/extension/application/ext/clients/base/views/profileaiptions/addprofileaigtionlink.php.

<?php

$viewdefs['base']['view']['profileactions'][] = array(
    'route' => '#Styleguide',
    'label' => 'LNK_STYLEGUIDE_C',
    'icon' => 'icon-link',
);

创建扩展文件后,导航到admin> Repair >快速修复和重建。这将将您的个人资料操作项附加到现有链接列表中。

笔记: 您可能需要刷新页面以查看新配置文件菜单项。

To remove a profile action link, loop through the list of profile actions and remove the item by one of its properties. For your reference, the stock profile actions can be found in ./clients/base/views/profileactions/profileactions.php.

./custom/extension/pplication/ext/clients/base/views/profileaiones/removeprofileactionlink.php.

<?php

if (isset($viewdefs['base']['view']['profileactions'])) {
    foreach ($viewdefs['base']['view']['profileactions'] as $key => $profileAction) {
        //remove the link by label key
        if (in_array($profileAction['label'], array('LNK_ABOUT'))) {
            unset($viewdefs['base']['view']['profileactions'][$key]);
        }
    }
}

创建扩展文件后,导航到admin> Repair >快速修复和重建。这将从现有链接列表中删除配置文件操作项。

笔记:  您可能需要刷新页面以查看已删除的配置文件菜单项。

最后修改:2021-02-17 02:44:13