- How to Configure an NPM Package?
- How to Implement Asset Picker?
- How to Implement Asset Check-In?
- How to Implement Collection Browse?
- How to Create a Custom Search Tool?
- How to Filter Files in Asset Picker Dialog Based on Content Types?
- How to Browse Files in Collections in Your Custom Plugin?
- How to Hide/Disable Top-Bar Menu Actions from Workspace?
How to Hide/Disable Top-Bar Menu Actions from Workspace?
Introduction
The Top-Bar Menu Action Extensibility feature allows platform administrators—such as content architects and system administrators—to hide or disable specific actions in the workspace top-bar dropdown menu through backend configuration (using visibility handler).This capability works similarly to the existing asset context menu action extensibility, giving teams more control over the UI and allowing them to tailor user actions to organizational needs.To enable this feature in your platform, you must complete three configuration steps described below.
Step 1: Add entity-actions.js to extensibility.json
Ensure that the entity-actions.js file is registered inside the extensibility.json.
If the file is not already present, download it from the sample package and add it manually.The extensibility.json file contains a javascripts property, which is an array of script paths relative to the conf directory.
Example (extensibility.json):
{
“javascripts”: [
“entity-actions.js”
]
}
Note: The file path must be relative to the conf folder.
Step 2: Define the Visibility Handler in entity-actions.js
Your entity-actions.js must include a visibility handler function. This function determines whether a top-bar action should be shown or hidden based on the selected entities and allows you to define the business logic that controls when an action should be disabled within the workspace.
Below is the sample implementation:
window.EntityActions = {
// The function referenced in entity-actions.json
visibilityHandler: (entity) => {
// Handle both single entity and an array of entities
const entities = Array.isArray(entity) ? entity : [entity];
// Return true to show the option and false to hide it
return entities.every(entity_ => entity_.type !== "collection");
},
topbarVisibilityHandler: (entity) => {
// Handle both single entity and an array of entities
const entities = Array.isArray(entity) ? entity : [entity];
console.log("Entity ids:", entities.map(entity_ => entity_.id));
}
}
Step 3: Register the Visibility Handler in entity-actions.json
Once the handler is created, you must register it in the entity-actions.json, where you will associate the visibility handler with the Top-Bar View Actions.
{
"topbarViewActions": [
{
"id": "qpp-download-action",
"context": ["favorite","browse"],
"visibilityHandler": "topbarVisibilityHandler"
}
]
}
To download sample, click here.