Add role based external links to the main menu



Author: @Xavier Thevenot

To enable users to easily open external links, configure the platform to display an additional icon in the main menu.

The external links menu will open from the icon.

Each external link will display for specific role IDs. The platform will only display the external links button if the user's role has at least one allowed link.

To configure the new icon do the following steps

Configure client property

In client-config-custom.json file, configure the "client.header.externalurlicons" client property

External URL
"client.header.externalurlicons" : [ { "url": "https://www.abiquo.com", "icon":"fa fa-user", "label":"Abiquo", "labelCode":"abiquo", "roleIds": [ 1,2,3] }, { "url": "https://www.google.com", "icon":"fa fa-google", "label":"Google", "labelCode":"google", "roleIds": [1] } ]



The property is a list of url objects and for each object you can set following attributes:

Name

Type

Required

Description

Example

Name

Type

Required

Description

Example

url

String

true

The url of the external link that will open in a new browser window

"https://www.abiquo.com"

icon

String

false

You can add an icon to your external link. You can specify a valid FontAwesome icon code

"fa fa-google"

label

String

true

The label displayed for the external link

"Abiquo"

labelCode

String

false

The code to display the label in each of the available platform languages. You can define labels in each lang_XX_custom.json file with the format "mainmenu.button.externalurlicons.label.(labelCode)" For example, labelCode="abiquo":

  • lang_en_US_custom.json "mainmenu.button.externalurlicons.label.abiquo" :"Abiquo website",

  • lang_es_ES_custom.json "mainmenu.button.externalurlicons.label.abiquo" :"Página web de Abiquo",

"abiquo"

roleIds

Array

true

The array of role ids allowed to display the external link. To obtain role IDs, use the methods of the Roles resource of the Abiquo API

[1,2,3]



Configure the language file

In the language file, for example, "/var/www/html/lang/lang_en_US_custom.json", add the appropriate labels, for example:

{ "mainmenu.button.externalurlicons.label.abiquo" :"Abiquo website", "mainmenu.button.externalurlicons.label.google" :"Google search engine" }







Copyright © 2006-2024, Abiquo Holdings SL. All rights reserved