Search code examples
grav

Custom theme's blueprints not being detected in Admin plugin at all


Following this example: https://learn.getgrav.org/forms/blueprints/example-page-blueprint

I created my video.yaml file under "user/themes/MYTHEMENAME/blueprints", contents of its file:

title: Gallery
'@extends':
    type: default
    context: blueprints://pages

form:
  fields:
    tabs:
      type: tabs
      active: 1

      fields:
        gallery:
          type: tab
          title: Gallery

          fields:
            header.txf:
              type: text
              label: Add a number
              default: 5
              validate:
                required: true
                type: int

            header.sb:
              type: select
              label: Select one of the following
              default: one
              options:
                one: One
                two: Two
                three: Three

Cleared all caches, but i still don't see that tab under "/admin/pages" or "/admin/pages/home" advanced tab. What's wrong? Is it bug?

UPDATED INFO

"user/themes/MYTHEMENAME/MYTHEMENAME.yaml":

enabled: true
dropdown:
  enabled: true

"user/config/site.yaml":

title: domain.org
author:
  name: Name
  email: 'email@mail.com'
metadata:
    description: 'analytical news feed'
    generator: 

Tried to put them under "user/blueprints/pages/" - still not EFFECT! Why such an easy tasks is too complicated in grav...


Solution

  • Your blueprint is correct, it works on my side.

    You said you don't see that tab under "/admin/pages" or "/admin/pages/home". This is not how a blueprint works, blueprint is only available for its page template. You didn't mention any sample paths of your page so it seems your page use a different template.

    If your blueprint is user/themes/yourtheme/blueprints/video.yaml, it is only available for the pages which use video template, for example user/pages/home/video.md. Your blueprint will not available to all pages on the site.

    Similar to modular template, you need to put your blueprint in modular folder: user/themes/yourtheme/blueprints/modular/video.yaml, and your modular page needs to use that template as well user/pages/home/_myvideo/video.md