Loading...
Loading...
Implement entity actions in Umbraco backoffice using official docs
npx skill4agent add umbraco/umbraco-cms-backoffice-skills umbraco-entity-actions/Umbraco-CMS/src/Umbraco.Web.UI.Client/examples/manipulate-document-property-value-permissions//Umbraco-CMS/src/Umbraco.Web.UI.Client/examples/user-permission/umbraco-repository-patternumbraco-context-apiumbraco-conditionsimport type { ManifestEntityAction } from '@umbraco-cms/backoffice/extension-registry';
import { MyEntityAction } from './my-entity-action.js';
const manifest: ManifestEntityAction = {
type: 'entityAction',
alias: 'My.EntityAction',
name: 'My Entity Action',
weight: 10,
api: MyEntityAction,
forEntityTypes: ['document'],
meta: {
icon: 'icon-alarm-clock',
label: 'My Action',
},
};
export const manifests = [manifest];import { UmbEntityActionBase } from '@umbraco-cms/backoffice/entity-action';
import type { UmbControllerHost } from '@umbraco-cms/backoffice/controller-api';
export class MyEntityAction extends UmbEntityActionBase<never> {
constructor(host: UmbControllerHost, args: { unique: string; entityType: string }) {
super(host, args);
}
async execute() {
// this.unique contains the entity's unique identifier
console.log('Executing action on:', this.unique);
// Perform your action here
alert(`Action executed on ${this.unique}`);
}
}import { UmbEntityActionBase } from '@umbraco-cms/backoffice/entity-action';
export class MyEntityAction extends UmbEntityActionBase<MyRepository> {
constructor(host: UmbControllerHost, args: { unique: string; entityType: string; repositoryAlias: string }) {
super(host, args);
}
async execute() {
// Access repository via this.repository
await this.repository?.myCustomMethod(this.unique);
}
}export class MyLinkAction extends UmbEntityActionBase<never> {
async getHref() {
return `/some/path/${this.unique}`;
}
async execute() {
// Not needed when using getHref
}
}documentmediamemberdata-typedocument-typemedia-type