Warren Buckley
02/25/2024, 5:01 PMExecute
method ?Warren Buckley
02/25/2024, 5:14 PMapi
in the manifest
We have a method in the example code called Execute()
I am unsure how the Entity Action in the dropdown knows how to run the Execute
method when the item is clicked?
So a wider a question how would I know to have called the method this (as I get no completions to know about this method) ?
Can @Jacob Overgaard or @Niels Lyngsø perhaps shed some light on this for me please
ts
import { UmbControllerHostElement } from "@umbraco-cms/backoffice/controller-api";
import { UMB_DOCUMENT_ENTITY_TYPE, UmbDocumentItemRepository } from "@umbraco-cms/backoffice/document";
import { UmbEntityActionBase } from "@umbraco-cms/backoffice/entity-action";
import { UMB_NOTIFICATION_CONTEXT, UmbNotificationContext } from "@umbraco-cms/backoffice/notification";
export class MyEntityAction extends UmbEntityActionBase<UmbDocumentItemRepository> {
#notificationContext? : UmbNotificationContext;
constructor(host: UmbControllerHostElement, repositoryAlias: string, unique: string) {
super(host, repositoryAlias, unique, UMB_DOCUMENT_ENTITY_TYPE)
console.log('repository alias', repositoryAlias);
console.log('unique', unique);
console.log('entity type', this.entityType);
this.consumeContext(UMB_NOTIFICATION_CONTEXT, (instance) => {
this.#notificationContext = instance;
});
}
// Question: How do we know what is calling the execute method
async execute() {
this.#notificationContext?.peek('warning', {
data: {
headline: 'A thing has happened !',
message: 'What that thing is? only time will tell.'
}
});
}
}
Jacob Overgaard
02/26/2024, 8:34 AMJacob Overgaard
02/26/2024, 8:35 AMJacob Overgaard
02/26/2024, 8:41 AMWarren Buckley
02/26/2024, 10:24 AMJacob Overgaard
02/26/2024, 12:15 PMWarren Buckley
02/26/2024, 12:16 PMWarren Buckley
02/26/2024, 12:19 PMgetHref
method as well or is the Storybook item describing actions out of date @Jacob Overgaard ?
https://apidocs.umbraco.com/v14/ui/?path=/docs/guides-extending-the-backoffice-entity-actions--docs#the-entity-action-classJacob Overgaard
02/26/2024, 12:21 PMWarren Buckley
02/26/2024, 12:47 PM