How to create a dialog in a plugin?

Hello Grav community,

Can you please briefly explain what steps are necessary to create a dialog that displays a form and a ‘save’ button? After pushing the ‘save’ button, the data should be saved somewhere in the plugin. The result should be similar to the ‘New Page’ dialog in the admin panel.

Now, I’m utterly new to Grav, so a brief overview would be very helpful. A few a few more specific questions are:
How can the dialog be created and displayed?
How to display a form in the dialog?
Where should the form be stored in the plugin? I.e. at which directory?
How can the data be saved in one of the plugins subdirectories after the ‘save’ button has been pushed?
How to dismiss the dialog if the cancel/x is pushed?

I took a closer look at the source code of the admin plugin, but could not figure out how to display the dialog, so a brief overview what needs to be done would be very helpful. Thank you.

My advice is to use the Form plugin to display a form, and process the form using a custom plugin

Thanks for sharing the link. One question that remains is how to create and display the dialog? Is there a simpler example than the new pages part of the admin plugin?

Are you doing in this in the Admin?

Yes, it’s an admin plugin.

Ok then the approach of using the Form plugin is not valid, I thought you meant in the frontend.

Currently there are no examples of plugins doing this, some plugins (Data Manager, Comments) add an admin panel, but just for showing data, they do not offer the ability to add more content. You’ll need to study and mimik how the Admin Plugin works, there are currently no guide for doing so, even though we’d like to have one.