Extends Plugin Blueprint

Hi,

Is it possible to extends a blueprint located in a plugin in a file located outside of the plugin ?

For example, I have my default.yml blueprint file located at /site/blueprints/page/default.yml:

title: Simple Page
icon: πŸ“

columns:
  main:
    sections:
      fields:
        type: fields
        fields:
          layout: fields/custom-layout

And the file in my plugin located at /site/plugins/custom-layout/blueprints/fields/custom-layout.yml

label: Layout
type: layout
layouts:
  - "1/1"
  - "1/2, 1/2"
  - "1/3, 1/3, 1/3"
  - "1/3, 2/3"
  - "2/3, 1/3"
  - "1/4, 1/4, 1/4, 1/4"

I tried with this /site/plugins/custom-layout/index.php, but it doesn’t seem to work:

<?php

Kirby::plugin('hugo/custom-layout', [
  'blueprints' => [
          'fields/custom-layout' => __DIR__ . "/blueprints/fields/custom-layout.yml",
  ],
]);

ChatGPT gave me this solution, it seems to work pretty well, keep you informed if there is errors.

<?php

Kirby::plugin('hugo/custom-layout', [
    'blueprints' => [
        'fields/custom-layout' => __DIR__ . '/blueprints/fields/custom-layout.yml',
    ],
    'fieldMethods' => [
        'custom-layout' => function ($value) {
            return $value;
        },
    ],
]);

ChatGPT’s database only lasts until September 2021. Two years of missing knowledge is a long time for software changes. Glad you were able to find help there. My queries are always 90% out of context with Kirby and are useless. Pure PHP works just fine though, as long as you understand the code and can spot inconsistencies.

Wondering what the field method is doing there, it has nothing to do with the blueprint.

Your original example should have worked, unless your file path was wrong, or you have a typo somewhere.

Yes, I checked and it work without the fieldMethods, it was probably a typo ^^’