Custom Fields
Re-Envisioned
Support MB Blocks Configuring WYSIWYG Buttons not working

  • Creator
    Topic
  • #19723
    Rebecca Rossi
    Participant

    So using a the WYSIWYG in a block and trying to pass button settings doesnt work

    'options' => array(
                            'tinymce' => array(
                                'toolbar1' => 'bold, italic',
                                'toolbar2' => '',
                            ),
                        ),

    In the end im trying to get the Format Select Dropdown to show because its not showing for me at all .

Viewing 3 replies - 1 through 3 (of 3 total)
  • Author
    Replies
  • #19728
    Long Nguyen
    Moderator

    Hi,

    Could you please share full the code to create the field WYSIWYG? I will copy your code and check on my end.

    Here is my sample code

    function your_prefix_get_meta_box( $meta_boxes ) {
        $prefix = 'prefix-';
    
        $meta_boxes[] = array(
            'id' => 'untitled',
            'title' => esc_html__( 'Untitled Metabox', 'metabox-online-generator' ),
            'post_types' => array('post', 'page' ),
            'context' => 'advanced',
            'priority' => 'default',
            'autosave' => 'false',
            'fields' => array(
                array(
                    'id' => $prefix . 'wysiwyg_1',
                    'name' => esc_html__( 'WYSIWYG', 'metabox-online-generator' ),
                    'type' => 'wysiwyg',
                    'options' => array(
                        'tinymce'       => array(
                            'toolbar1'      => 'bold,italic',
                            'toolbar2'      => '',
                            'toolbar3'      => '',
                        ),
                    ),
                ),
            ),
        );
    
        return $meta_boxes;
    }
    add_filter( 'rwmb_meta_boxes', 'your_prefix_get_meta_box' );

    and it works as well https://share.getcloudapp.com/rRu9xWm1.

    #19736
    Rebecca Rossi
    Participant
    public function mjmc_block_half_video_half_text($meta_boxes) {
    
            $meta_boxes[] = [
                'title'           => 'Half Video/Half Text',
                'id'              => 'half-video-half-text-content',
                'description'     => 'creates a block with 50% Video / 50% Text',
                'type'            => 'block',
                'icon'            => 'awards',
                'category'        => 'howell-blocks',
                //'context'         => 'side',
                'render_callback' => 'mjmc_block_half_video_half_text_render',
                //'enqueue_style'   => get_template_directory_uri() . '/blocks/hero/style.css',
                'supports' => [
                    'align' => ['full'],
                    'anchor' => true,
                    'customClassName' => true,
                ],
        
                // Block fields.
                'fields'          => [
                    [
                        'type' => 'color',
                        'id'   => 'background_color',
                        'name' => 'Background Color',
                        'js_options'    => array(
                            'palettes' => array( '#004B87', '#FFC629', '#F3F3F3','#FF6B00', '#005CAB', '#3DAE2B')
                        ),
                    ],
                    [
                        'type'  => 'text',
                        'id'    => 'video_iframe',
                        'name'  =>  'Iframe Code'
                    ],  
                    [
                        'type' => 'select',
                        'id'   => 'align_video',
                        'name' => 'Align Video',
                        'options'         => array(
                            'left'       => 'Left',
                            'right' => 'Right',
                        ),
                    ],  
                    [
                        'type'  => 'wysiwyg',
                        'id'    => 'content',
                        'name'  =>  'Content',
                        'options' => array(
                            'tinymce'       => array(
                                'toolbar1'      => 'bold,italic',
                                'toolbar2'      => '',
                                'toolbar3'      => '',
                            ),
                        ),
                    ]
                    
                ],
            ];
            return $meta_boxes;
            
        }

    the Tinymce tool bar doesnt change at all on my end. Other editor settings like: ‘media_buttons’ => FALSE works just fine.

    #19742
    Long Nguyen
    Moderator

    Thank you, I will check it out and let you know later.

Viewing 3 replies - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.
grid gear info copy caret-up caret-down trash