Custom Fields
Re-Envisioned
Support MB Blocks Would it be possible to access a block name from within a callback/template?

  • Creator
    Topic
  • #16222
    Resolved Przemek
    Participant

    We have an access to $attributes, $is_preview, and $post_id within the callback.

    Couldn’t we have an access to the block name as well? It would be helpful when we want to handle multiple block types with a single callback function.

    Perhaps:
    $attributes['name'] or $attributes['blockname']

Viewing 1 replies (of 1 total)
  • Author
    Replies
  • #16240
    Anh Tran
    Keymaster

    Hi Przemek,

    That’s a rare case. I didn’t think about using a same callback function for different blocks.

    Anyway, new version has just been pushed and you can access to the block name via $attributes['name'].

Viewing 1 replies (of 1 total)
  • You must be logged in to reply to this topic.