Now I want to add an Entity Action in the content tree’s context menu, but none of the examples I can find seem to work. Furthermore the examples seem to be intended for a different approach (I’m guessing added directly into the CMS project).
Does anyone have a working example where an Entity Action is added as an extension/package
The example that you have provided is my challenge in a nutshell. In the source code of the CMS I see a lot of manifest files where the actions are being added in the exact way that you describe.
The problem is though, that to register the action as an extension, the examples tell me to create an umbraco-package.json to register the extension.
This doesn’t tell me how to hook up the class via the api property that you have in your example.
So it seems that it is two different approaches, and all the examples look like they are just snippets of manifests that can’t directly be translated to umbraco-package.json files.
But maybe I’m just missing some detail here? I just can’t see how I could use the examples as a starting point for an extension.
The reason why I dont see that problem is because I know that the ‘api‘ property can be a inline JS-method, like the exmaple above or it can be a string pointing to the file.
So in JSON the above manifest would look like this:
I think its worth highlighting that writing your manifests in JSON is not the greatest experience.
Your starting point has to be a JSON. But you can use an extension called bundle, which takes a JS file of manifests.
In this way, you will be able to write your manifests in JS.
Then I hope that will enable you to use the source code for inspiration, cause theoretically there should be no difference between what the Core code does and an extension is able to do.
I saw the resemblance between the manifest and the package.json, but I just couldn’t make it work, so hopefully this is the missing link.
As you point out this is not the preferred method, but I just wanted to try a simple example before delving into setting up a visual studio project. (the way I can see is the recommended method)