All plugin events available in mytheme.php?

Docs say that we can use plugin events, are all available just as they would be for plugins?

Reason for it would be to override a setting that’s in mytheme.yaml. Is there a better way of doing it besides if (!isset(page.header.width )) page.header.width = $this->config->get(‘width’)

Yes you can use all plugin events in your theme’s PHP file. They are like a special-case plugin.

That is awesome, and I’d be able to set ‘form’ options in YAML to have those options show in Admin when that time comes?

Yes, those will go in the blueprints.yaml. Any form items you define there will automatically show up in the admin.

That is awesome. I was working with Phile CMS which is very similar to Grav and I had to use a separate plugin to make it all work that way.

What would be the best way to have a page header override a setting set in mytheme.yaml?

Take a look at the SmartyPants plugin, here’s a code snippet:

$defaults = (array) $this->config->get('plugins.smartypants');
$page = $event['page'];

if (isset($page->header()->smartypants)) {
    $this->config->set('plugins.smartypants', array_merge($defaults, $page->header()->smartypants));

Basically does an array_merge to merge the page headers with the default configuration.

All events will work except for onPluginsInitialized. Instead of that you can use onThemeInitialized.