MB Block Select Advanced Multiple Times on Post Bug?

Support MB Blocks MB Block Select Advanced Multiple Times on Post Bug?

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #43884
    Andrew TegenkampAndrew Tegenkamp
    Participant

    I have the following block and it works well when adding it multiple times to a post. However, when I go back to edit the post, the select2 only works for one instance of the block and the other select items use a standard select. Is this a bug or do I have something setup wrong? For now I can workaround by using context => side and a render template and removing mode => edit, but I would prefer for this to use mode => edit.

    
    // Register a block for Gutenberg
    add_filter( 'rwmb_meta_boxes', function( $meta_boxes ) {
    	$meta_boxes[] = [
    		'title' => 'VIEW Post Picker',
    		'id'    => 'view-post-picker',
    		'type'  => 'block', // Important.
    		'icon'  => 'admin-post', // Or you can set a custom SVG if you don't like Dashicons
    		'category' => 'text',
    		//'context' => 'side', // The block settings will be available on the right sidebar.
    		'mode' => 'edit', //The default mode of the block: edit to make it shows the edit fields when loaded, preview (default) to show the rendered HTML when loaded.
    		//'render_template' => get_stylesheet_directory() . '/blocks/hero/template.php', // The PHP template that renders the block.
    		//'enqueue_style'   => get_stylesheet_directory_uri() . '/blocks/hero/style.css', // CSS file for the block.
    
    		// Now register the block fields.
    		'fields' => [
    			[
    				'id'   => 'vpp_post',
    				'type' => 'post',
    				'name' => 'Post or Page?',
    				'post_type' => ['post','page'],
    				'field_type'  => 'select_advanced',
    			],
    			[
    				'id'   => 'vpp_attachment',
    				'type' => 'post',
    				'name' => 'Attachment?',
    				'post_type' => 'attachment',
    				'field_type'  => 'select_advanced',
    				'query_args'  => [
    					'post_status'    => ['publish','inherit'],
    					'posts_per_page' => - 1,
    				],
    			],
    		],
    	];
    	return $meta_boxes;
    });
    
    #43899
    PeterPeter
    Moderator

    Hello Andrew,

    Thanks for your feedback.

    I can see the issue on my demo site. I've escalated this issue to the development team to fix the issue in the next update.

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