Inherit the grav admin theme


#1

Hello

I am trying to inherit the default grav theme of the admin plugin.

I followed the steps of the documentation for theme inheritance but it doesn’t seem to work and I could not find help online to figure out the reason.

Here is what I did:

  1. I created a new folder ‘user/plugins/admin/themes/mytheme’ containing a ‘templates’ subfolder with my modified templates.

  2. at the root of the ‘mytheme’ folder, I created mytheme.yaml with the following content:

streams:
 schemes:
   theme:
     type: ReadOnlyStream
     prefixes:
       '':
         - user/plugins/admin/themes/mytheme
         - user/plugins/admin/themes/grav
  1. I created a file in user/config/plugins/ called ‘admin.yaml’, and added ‘theme: mytheme’ inside.

That’s all.

Now, when I load a page of the admin panel, it uses mytheme, but fails to load a partial template that only exists in the parent ‘grav’ theme. It seems that the configuration I set in mytheme.yaml is ignored and there is no fallback to the grav default theme when a template file is not found in my custom theme.

This is the error I get:

RuntimeException (400)

Template “partials/base.html.twig” is not defined in “pages.html.twig” at line 1.

Previous exceptions

  • Template “partials/base.html.twig” is not defined in “pages.html.twig” at line 1. (0)

I am now wondering if theme inheritance is working for the Admin plugin. If it does, what else should be done?

Thank you in advance for any help on this.

Maxime