Call a hook to get all of the sidebar controls

This commit is contained in:
Oliver-Akins 2025-05-01 21:09:48 -06:00
parent eac23400a8
commit 8c9fd1930a
2 changed files with 29 additions and 15 deletions

View file

@ -38,6 +38,26 @@ export class StatSidebar extends HandlebarsApplicationMixin(AbstractSidebarTab)
ctx.tableCount = db.getTables().length;
const controls = {
openStats: { label: `View Stats`, action: `openStats` },
createTable: { label: `Create New Table`, action: `createTable` },
manageTables: { label: `Manage Tables`, action: `` },
manageData: { label: `Manage Data`, action: `` },
};
if (!game.user.isGM) {
delete controls.createTable;
delete controls.manageTables;
};
const canManageTheirOwnData = false;
if (!game.user.isGM && !canManageTheirOwnData) {
delete controls.manageData;
};
Hooks.callAll(`${__ID__}.getStatsSidebarControls`, controls);
ctx.controls = Object.values(controls);
return ctx;
};