Extending a specific page template in Admin

Okay, so I have something that does not work although it should, and also some general questions about how best to tackle this. I’m writing a plugin (attaching Cloudinary assets to Grav pages) that has two special page templates, one of which has specific frontmatter. My goal is to change the Admin page form a little for the latter case:

  1. If the page is of type cloudinary-single and has no public_id set in the frontmatter, show the Cloudinary upload widget (just a little javascript).
  2. If the page is of type cloudinary-single and HAS a public_id set in the frontmatter, show a thumbnail of that remote file (I can build the url with the CloudinaryPlugin class I already have).

I’m not quite sure what would be the best way to accomplish this – if anyone could provide a general outline, that would be super helpful already!

What I have done so far is, I’ve followed the docs on creating custom page templates for admin panel. I’ve simply copied the blueprint to its respective folder and all the code into my plugin class and left the example field as is, just to see if this works, and it doesn’t. I have no idea why.

I have triple-checked all my functions and which events are registered and whatnot, and that extra field simply will not show up. :thinking:

Here is the repository with the latest bits of code. Any help is much appreciated!

Hey I got it to work by myself – I was missing a simple line: 'onGetPageTemplates'wasn’t registered in getSubscribedEvents(), but that was were I’d told Grav to go looking for templates. Now I’m cooking! :wink: