Can i use plugin registered blueprints as extensions?

So I created a blueprint in my plugin like this:

Can I use it as an extension in my site now? (doesn’t seem to work) But maybe it’s not ment to be used like that? I can’t seem to find any documentation about it.

plugin

Kirby::plugin('test/tester', [
    'options' => [
        //
    ],
    'blueprints' => [
        'tabs/fragments' => __DIR__.'/site/blueprints/tabs/fragments.yml',
    ],
]);

site.yml

title: Site
preset: pages
unlisted: true

tabs:
  fragments: tabs/fragments

Where did you put that blueprint? If you register a blueprint in a plugin, it should be somewhere in your plugin folder. But your path seems to be going nowhere…? Or is site a folder inside your plugin folder?

There is no point in registering blueprints that are in site/blueprints via a plugin…

It’s a site folder within my plugin folder yes so i have /pluginfolder/site/blueprints/tabs/fragments.yml (the /site/ doesn’t really need to be there but it’s for me to keep a bit of structure)

I’m not sure what you mean with there’s no point? If I want to make something that I like to reuse a lot it’s easy to have the blueprint of that functionality also in the plugin? no?

Yes, of course, I was just irritated by the folder name and thought you wanted to register something in the site/blueprints folder.

What is in fragments.yml?

Nothing to fancy, it works if I use it in the “normal” blueprints in my tabs

label: fragments
icon: book
columns:
  - width: 1/1
    sections:
      fragmentsMain:
        type: fields
        fields:
          fragments:
            type: structure
            fields:
              key:
                type: text
                width: 1/3
              value:
                type: textarea
                buttons: false
                width: 2/3

You have to remove preset: pages from site.yml

1 Like

:man_facepalming: Cheers mate!