I’m making a custom dashboard in Umbraco 16, listing some Content Types. Now I want to open the content type edit in a modal. Just like Umbraco does on the info workspace on regular content.
Something tells me that should be able to build the correct url, but I don’t know how. The Umbraco source code is super convoluted, so it’s not very helpful.
It’s not that simple at the current moment, but surely possible.
You need to register a Routable Modal for Workspaces, and then append a bit to the Path for it to open the Workspace and the Content Type of choice.
First, declare this property:
@state()
private _editPath?: string;
And then add this in your constructor ( I hope you are cool with finding the imports yourself, if you use VS Code, it should be able to do it for you):
Cool. I did see something like that in input-document-type.element.ts. As you say, it’s not at simple, so I hope there would be a better/easier way
I will try that.
Niels’ solution uses the routing system to open the modal, which is also viable (you can get back to the modal you just opened with forward/back buttons in the browser).
It depends how much you want to do for the user experience.
Instead of “guys”, may we suggest, for example: “folks", “Umbracians”, “all”, or “everyone”? We use gender inclusive language in this forum (read more)