umbraco-entity-actions by umbraco/umbraco-cms-backoffice-skills
npx skills add https://github.com/umbraco/umbraco-cms-backoffice-skills --skill umbraco-entity-actions实体操作对 Umbraco 中的特定项目执行一个操作。它们为与文档、媒体或自定义实体等实体类型相关的次要功能提供了一个通用的扩展点。这些操作出现在后台管理界面的上下文菜单中,并且可以由用户权限控制。
在实现之前,请务必获取最新的文档:
Umbraco 源代码中包含可运行的示例:
权限操作 : /Umbraco-CMS/src/Umbraco.Web.UI.Client/examples/manipulate-document-property-value-permissions/
此示例演示了操作文档属性权限的实体操作。
用户权限 : /Umbraco-CMS/src/Umbraco.Web.UI.Client/examples/user-permission/
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
此示例展示了与用户权限控制集成的实体操作。
仓库模式 : 当实现需要数据操作的动作时
umbraco-repository-pattern上下文 API : 当需要从操作中访问工作区或其他上下文时
umbraco-context-api条件 : 当需要根据权限或状态控制操作可见性时
umbraco-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 包含实体的唯一标识符
console.log('Executing action on:', this.unique);
// 在此处执行您的操作
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() {
// 通过 this.repository 访问仓库
await this.repository?.myCustomMethod(this.unique);
}
}
export class MyLinkAction extends UmbEntityActionBase<never> {
async getHref() {
return `/some/path/${this.unique}`;
}
async execute() {
// 使用 getHref 时不需要此方法
}
}
document - 内容节点media - 媒体项member - 会员data-type - 数据类型document-type - 文档类型media-type - 媒体类型就是这样!请务必获取最新的文档,保持示例简洁,生成完整可运行的代码。
每周安装数
76
仓库
GitHub 星标数
17
首次出现
2026年2月4日
安全审计
安装于
github-copilot56
cursor25
opencode24
codex24
gemini-cli22
amp22
Entity Actions perform an action on a specific item in Umbraco. They provide a generic extension point for secondary functionality associated with entity types like documents, media, or custom entities. These actions appear in context menus throughout the backoffice and can be controlled by user permissions.
Always fetch the latest docs before implementing:
The Umbraco source includes working examples:
Permission Manipulation : /Umbraco-CMS/src/Umbraco.Web.UI.Client/examples/manipulate-document-property-value-permissions/
This example demonstrates entity actions that manipulate document property permissions.
User Permissions : /Umbraco-CMS/src/Umbraco.Web.UI.Client/examples/user-permission/
This example shows entity actions integrated with user permission controls.
Repository Pattern : When implementing actions that need data operations
umbraco-repository-patternContext API : When accessing workspace or other contexts from actions
umbraco-context-apiConditions : When controlling action visibility based on permissions or state
umbraco-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
}
}
document - Content nodesmedia - Media itemsmember - Membersdata-type - Data typesdocument-type - Document typesmedia-type - Media typesThat's it! Always fetch fresh docs, keep examples minimal, generate complete working code.
Weekly Installs
76
Repository
GitHub Stars
17
First Seen
Feb 4, 2026
Security Audits
Gen Agent Trust HubPassSocketPassSnykPass
Installed on
github-copilot56
cursor25
opencode24
codex24
gemini-cli22
amp22
React 组合模式指南:Vercel 组件架构最佳实践,提升代码可维护性
122,000 周安装