Extending grav-plugin-admin;

Hi all,
I am currently working on a gallery plugin for grav and I am wondering whether anybody could help with suggesting a clean strategy of extending the admin plugin to accomplish the following:

  • Custom ‘edit page’ view for a certain page type
  • Drag and drop sorting of page media inside the new ‘edit page’ view

I have two general questions:

  1. My approach until now was to add a page blueprint to define a custom admin page form that opens when editing the pages of the specific page type in the pages section. But the page blueprint form limits my options a little. I.e. how would I add custom js files to realize my drag and drop media sorting?
    Of course I could add a complete different section to the admin menu (e.g. /admin/gallery) to get full control over the html/css/js surrounding the form but I would really like to integrate my plugin into the existing pages section. What would be my best option here? Adding custom form fields to include the required javascript? Does not sound like the right place.

  2. My next question is about custom admin tasks (i.e. per sisting the media order). As far as I understand, the admin plugin instantiates an admin controller that implements certain tasks. Is there any place to register plugin tasks? Or is the only way right now to implement another Plugin Controller that does the routing to plugin specific tasks?

You could add a new JS file via the theme or via a plugin, if it’s something that can be simply managed through a javascript file, or add your own form field through a plugin.

About the controller, we have in the plans a way to extend the Admin plugin to provide your own controller actions, currently it’s not something we baked in the plugin, you basically need to create your own views through a plugin (much like Comments / Data Manager do) and also provide form handling.

We plan to provide some framework / guidance on doing so soon.