Documentation on how to create a custom field?

Hi,

Is there any documentation on how to create a new custom field that is based on another one?

I’m basing myself on the structure field but just adding a small change.

Yes, there is

1 Like

Thanks!

I tried this:

<?php

Kirby::plugin('jojo/hello', [
    'fields' => [
        'hello' => [
            'extends' => 'structure'
        ]
    ]
]);

But when using “hello” as a field type in my blueprint I get the following message:
The field type "blocks" does not exist :thinking: :thinking:

I replaced this:

blocks:
  label: Blocks
  type: structure
  fields:
    ...

With this:

blocks:
  label: Blocks
  type: hello
  fields:
    ...

And it breaks.

Could you share full blueprint please?

Did a fresh install with plainkit. This is the blueprint:

title: Default Page
preset: page
fields:
  text:
    label: Text
    type: textarea
    size: large
  blocks:
    label: Blocks
    type: hello
    fields:
      type:
        label: Type
        options:
          one: Option 1
          two: Option 2
          three: Option 3
        type: select

If I replace type: structure with type: hello it breaks.

My mistake! Forgot to add index.js :grimacing: :grimacing: :grimacing: