admin管理员组

文章数量:1391947

I am not able to get the Gutenberg editor in CMB2 (repo). I have follow the comment mentioned on the example file but not working.

I have set the 'mb_callback_args' => [ '__block_editor_compatible_meta_box' => true ] but doesn't make any difference.

$cmb = new_cmb2_box( [
    'id'               => 'book_item_meta_box',
    'title'            => __( 'Book Data Section', 'booker' ),
    'object_types'     => [ 'book', ],
    'context'          => 'normal',
    'priority'         => 'high',
    'show_names'       => true,
    'mb_callback_args' => [ '__block_editor_compatible_meta_box' => true ],     
] );

Any help please?

I am not able to get the Gutenberg editor in CMB2 (repo). I have follow the comment mentioned on the example file but not working.

I have set the 'mb_callback_args' => [ '__block_editor_compatible_meta_box' => true ] but doesn't make any difference.

$cmb = new_cmb2_box( [
    'id'               => 'book_item_meta_box',
    'title'            => __( 'Book Data Section', 'booker' ),
    'object_types'     => [ 'book', ],
    'context'          => 'normal',
    'priority'         => 'high',
    'show_names'       => true,
    'mb_callback_args' => [ '__block_editor_compatible_meta_box' => true ],     
] );

Any help please?

Share Improve this question asked Feb 13, 2019 at 7:43 pixelngrainpixelngrain 1,3901 gold badge23 silver badges50 bronze badges 4
  • What do you mean by "get the Gutenberg editor in CMB2"? Do you want to add your custom field to Gutenberg? Or are you trying to use Gutenberg as a field? – Jacob Peattie Commented Feb 13, 2019 at 13:22
  • I want Gutenberg use as metabox. CMB2 allow to use metabox type WYSIWYG but I am trying to use Gutenberg instead. I have read their docs and try to get it but nothing works. – pixelngrain Commented Feb 14, 2019 at 6:44
  • I don't believe this is possible. This is probably why there's nothing in their docs about it. Regardless, questions about 3rd-party plugins should be directed to their developers. – Jacob Peattie Commented Feb 14, 2019 at 6:54
  • Hmm. so is there any way where I can implement or customize to get the Gutenberg editor in custom metabox? – pixelngrain Commented Feb 14, 2019 at 7:07
Add a comment  | 

1 Answer 1

Reset to default 1

This is, at least at the moment, not possible. You can use CMB2 Meta Boxes in Gutenberg Post Types, but you can not make a CMB2 Field where you can use Gutenberg - as of now.

However, as the Gutenberg Editor is developed further, a CMB2 Block-Editor-Field is not that far. As of now, you can already integrate the Block Editor on your own admin page (see https://github/getdave/standalone-block-editor for instance).

So, if you only need a settings page with a Block Editor, you could use this. You could also try and implement this code into a custom CMB2 Field (I'm not sure this is possible at the moment).

Happy Coding!

本文标签: metaboxHow to use Gutenberg in CMB2