How can I register blueprint/group-field in plugin?


#1

Hi, how can I register a blueprint/group-field inside a plugin?

I´ve tried…

// path: plugins/my-plugin/my-plugin.php
$kirby->set('blueprint/field', 'testgroup2', __DIR__. DS .'testgroup2.yml');
# path: plugins/my-plugin/testgroup2.yml
type: group
fields:
  testgroup2_headline:
   label: Testgroup 2
   type: headline
  testgroup2_text:
    label: Text 
    type:  text

#2

Assuming that the file is called metadata.yml and lives in /site/plugins/your-plugin/blueprints/fields:

<?php

kirby()->set('blueprint', 'fields/metadata', __DIR__ . '/blueprints/fields/metadata.yml');

#3

Works perfectly!

Thank you very much texnixe!