Using new object field as a block

Hi, I can’t find any way to use the new (Kirby 3.8) object field as a specific block insiede a block type field.

If there’s no way to accomplish that - do the Kirby staff already have it in their roadmap? :slight_smile:

I don’t really understand your question. What have you tried to do? and please post your code. Of course you can add an object field to your custom block or to a modified default block.

Sorry. I meant - I couldn’t find a way using standard blocks. I’ll check the modified default block way. Thanks

There is no default object block, don’t think that would make sense. And the default blocks don’t use an object field, don’t know where this would make sense for the existing blocks?

Use case: putting one or more short book review (field type: object → title, author, publisher, cover, review) inside a generic blog post (field type: blocks).

Object field could be so helpful as a block!

Just create a custom block, it’s easy. Look at these examples: Block factory: Creating your own blocks collection | Kirby CMS

Since the fields inside an object have to be defined (just like in a structure), a generic object block doesn’t make much sense.

Ok, I’ve read the recipe but… I stick with the idea that using the object field would be easier and it would require much less code. In general, for what I can understand of blocks field, almost every other kirby field should be used as a single block!

It just doesn’t make sense. You might want an object field with street, city and postal code, the next user wants an object field with location, event date and event title, etc. How would you create a single block for these different objects? Maybe I’m missing something.

How would you create a single block for these different objects?

Object block types would need proper configuration, then. Something like:

text:
    label: Testo
    type: blocks
    fieldsets:
      - text
      - image
      - object
      image:
        extends: blocks/image
        fields:
          css:
            label: Css
            type: text
            width: 1/4
      object:
        fields:
          photo:
            type: files
          name:
            type: text
          email:
            type: email
          ```

Feel free to create a feature request on https://feedback.getkirby.com/

1 Like

Hello,
I’m trying to follow the recipe for building custom blocks… but for every custom block i’m getting the following error in the panel:

this.$refs[(“block-” + t.id)][0] is undefined

I know there’s another post here on the forum with the same issue, but I couldn’t get how to fix it anyway…

Please post your code…

…bug found!
@texnixe you can fix mu code just with your (on line) presence!

:joy: