- Create a blueprint for your page, say
gallery.yamland put in the fields you want, or extend the default page (read the docs on that here). - Put that blueprint in a
blueprints/folder in your plugin folder. - Register those blueprints in your
plugin.phpcode by adding the following bits:
use RocketTheme\Toolbox\Event\Event;
public static function getSubscribedEvents()
{
return [
'onGetPageTemplates' => ['onGetPageTemplates', 0]
];
}
/**
* Add blueprint directory to page templates.
*/
public function onGetPageTemplates(Event $event)
{
$types = $event->types;
$locator = Grav::instance()['locator'];
$types->scanBlueprints($locator->findResource('plugin://' . $this->name . '/blueprints'));
$types->scanTemplates($locator->findResource('plugin://' . $this->name . '/templates'));
// ^^^ only necessary if you also have templates in your plugin
}
- Give your page that template, save and voilà! your fields should turn up in the Admin interface.
Hope this helps! (Actually I think most of this is in the docs I referenced above, but it might still help you and others out by condensing those a bit.
)