Open umbraco standard dialogs from a custom plugin
Hi,
I am working on a new plugin which is a new tab under the content section.
I would like to be able to open the Create node dialog from within my plugin controller.
Is this possible?
Like for example I will have a button to add a new root node, so if I click on it, it must open the dialog with the allowed root nodes.
I will also have buttons to create child nodes, so for an existing content node ( using its id ) if I then click on the add child node it must open the Create dialog with now the available child nodes for the given node id.
As the create dialog is more than just than a simple dialog you might create yourself it MIGHT be worth trying to imitate the behavior from treeOptionsClick handler in /umbraco/js/umbraco.services.js which then leads on to navigationService.showMenu
As a result code in your controller might look like this (wrapped in your own function with your own trigger added of course)
In the genuine implementation there are a bunch of properties within args, but it looks like the only important ones for the showMenu function are the node property which, if you can grab within your controller you can mock into an args object for use in this code, and 'skipDefault' which should be false if you want to show the create menu in the dialog.
This would require you inject both appState and navigationService into your controller.
Open umbraco standard dialogs from a custom plugin
Hi,
I am working on a new plugin which is a new tab under the content section.
I would like to be able to open the Create node dialog from within my plugin controller.
Is this possible?
Like for example I will have a button to add a new root node, so if I click on it, it must open the dialog with the allowed root nodes.
I will also have buttons to create child nodes, so for an existing content node ( using its id ) if I then click on the add child node it must open the Create dialog with now the available child nodes for the given node id.
Can anyone help me in the right direction?
/Michaël
Hi Michaêl,
Have you seen this documentation?
https://our.umbraco.org/apidocs/ui/#/api/umbraco.services.dialogService
Hope this helps,
/Dennis
Hi Dennis,
yes I have seen this documentation but I think I need more then this?
What do I need to inject to get the same result as clicking on the 3 dots next to the Content in the content section?
I see that its calling a function
options(tree.root, $event)
so I need to have the same behaviour but now on a custom button in my plugin./Michaël
Caveat this is untested:
As the create dialog is more than just than a simple dialog you might create yourself it MIGHT be worth trying to imitate the behavior from treeOptionsClick handler in /umbraco/js/umbraco.services.js which then leads on to navigationService.showMenu
As a result code in your controller might look like this (wrapped in your own function with your own trigger added of course)
In the genuine implementation there are a bunch of properties within args, but it looks like the only important ones for the showMenu function are the node property which, if you can grab within your controller you can mock into an args object for use in this code, and 'skipDefault' which should be false if you want to show the create menu in the dialog.
This would require you inject both appState and navigationService into your controller.
is working on a reply...