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

  • Creator
  • #16222
    Resolved Przemek

    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.

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

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

    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.
grid gear info copy caret-up caret-down trash