Blueprint for blocks

For a plugin I need to have access to the blueprint definition of the blocks. For a page I simply use

page()->blueprint();

But this blueprint doesn’t contain the blocks definitions (if blocks are used). I think this is because blocks are build-in and don’t use the extend-feature of blueprint-yml-files. So how can I get the blueprint e.g. for blocks/text?

You can fetch any blueprint by its name via Blueprint::find($blueprintName), e.g.

<?php dump(Kirby\Cms\Blueprint::find('blocks/text')) ?>

Returns an array like this:

Array
(
    [name] => field.blocks.text.name
    [icon] => text
    [wysiwyg] => 1
    [preview] => text
    [fields] => Array
        (
            [text] => Array
                (
                    [type] => writer
                    [nodes] => 
                    [placeholder] => field.blocks.text.placeholder
                )

        )

)
1 Like