Block doesn't render on editor unless I fill some field data

Support MB Blocks Block doesn't render on editor unless I fill some field dataResolved

Viewing 12 posts - 1 through 12 (of 12 total)
  • Author
    Posts
  • #35511
    Attachmedia SACAttachmedia SAC
    Participant

    I created a block to display a custom data I fetch from the DB, I don't need customization (fields) for this blocks. But in the editor doesn't render de template unless there is a field and the field is filled.

    add_filter( 'rwmb_meta_boxes', function ( $meta_boxes ) {
    	$meta_boxes[] = [
    		'title'           => 'My Block' ,
    		'id'              => 'my-block' ,
    		'type'            => 'block' ,
    		'mode'            => 'preview' ,
    		'render_callback' => function () { echo '<h1>My Block</h1>'; },
    	];
    
    	return $meta_boxes;
    });

    I have set mode=preview. What am I missing?

    #35528
    Long NguyenLong Nguyen
    Moderator

    Hi,

    The extension MB Blocks only support rendering the block if it has at least one custom field. I will inform the development team to consider supporting this case.

    #35542
    Attachmedia SACAttachmedia SAC
    Participant

    That would be great. Thank you.

    #35966
    Cereal ConceptCereal Concept
    Participant

    Hi !

    Do you have news on this ?
    I'm using InnerBlocks and sometime I don't need fields. I'm using MB Block to wrap code around gutenberg content.

    Thanks
    Johann

    #36554
    metafanmetafan
    Participant

    I need this feature too.
    Rendering some html-only block without triggering a custom field.

    Any news?
    Thanks!

    #36589
    Cédric DagherirCédric Dagherir
    Participant

    Hi ! Thanks for your whole work 🙂

    I need this feature too. Thanks.

    #38162
    GregGreg
    Participant

    I would also like the block to render even if there are no custom fields. It does not make any sense to tell the user, "Click the Edit icon in the block toolbar to enter content" if there are no fields to fill out.

    My block does technically have a "field" in the list of Fields in Edit Field Group, but it is just Custom HTML that explains the block has no settings. It still renders in the editor with the "Click the Edit icon" message.

    #38249
    JulienJulien
    Participant

    I need this feature too.

    Any news ?

    #40461
    Cédric DagherirCédric Dagherir
    Participant

    Hi !

    Did you integrate or plan to integrate this feature ?

    Thanks

    #40476
    metafanmetafan
    Participant

    Must have for good UX!!
    Any news?
    Thanks

    #40958
    DaveDave
    Participant

    I can think of use cases for this, is it implemented now?

    #44831
    David McGintyDavid McGinty
    Participant

    I would want this feature added as well. I have a spacer block, sometimes it takes classes but i'd like it to render on the page editor even if the user doesn't pass any data to the fields.

Viewing 12 posts - 1 through 12 (of 12 total)
  • You must be logged in to reply to this topic.