Support

Account

Home Forums Gutenberg Add custom data to acf_register_block_type()

Unread

Add custom data to acf_register_block_type()

  • Hey people,
    is it possible to add custom data when registering a block.

    My goal is:

    
    acf_register_block_type([
    'name' => 'test', 
    ...
    'custom_data' => ['key' => 'value']
    ]);
    

    and access this custom data when block is rendered in editor:

    
    window.acf.addAction("render_block_preview", function($el, atts){
    console.log(atts.custom_data);
    });
    

    Can anyone help?
    Thanks

Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.