WSYIWYG seems to be broken when using groups

Support MB Group WSYIWYG seems to be broken when using groups

Viewing 12 posts - 1 through 12 (of 12 total)
  • Author
    Posts
  • #1095
    billing@archcreativegroup.com[email protected]
    Participant

    I'm using the groups extension, and trying to use some WYSIWYG forms in my groups. I'm not trying to clone, I know that doesn't work =).

    What happens is, the first WYSIWYG box to display on the admin page renders just fine, but all subsequent ones aren't rendering correctly, they don't have the buttons on top of the editor, so it's impossible to do any formatting, italic, bold, etc.

    first wysiwyg

    2nd wysiwyg

    I have my metabox setup abstracted with functions a little bit so bare with me here. I will show you all my code though.

    FIELD MODULES
    used to abstract the creation of individual fields/groups

    <?php
    
    class Field_modules {
    	
    	static $text_block =  array(
    		array(
    			'name'  => 'title',
    			'id'    => 'title',
    			'type'  => 'text',
    			'clone' => false,
    		),
    		array(
    			'name'  => 'image',
    			'id'    => 'image',
    			'type'  => 'file_input',
    			'clone' => false,
    		),
    		array(
    			'name'  => 'copy',
    			'id'    => 'copy',
    			'type'  => 'wysiwyg',
    			'clone' => false,
    		),
    		array(
    			'name'  => 'button text',
    			'id'    => 'button_text',
    			'type'  => 'text',
    			'clone' => false,
    		),
    		array(
    			'name'  => 'button link',
    			'id'    => 'button_link',
    			'type'  => 'text',
    			'clone' => false,
    		),
    		array(
    			'name'  => 'background image',
    			'id'    => 'bg_image',
    			'type'  => 'file_input',
    			'clone' => false,
    		),
    	);
    	
    	static function create_tiles_group($box_prefix, $group_title, $number){
    		$returnArray = array(
    				'id'     => $box_prefix  . 'tile_'. $number,
    				'name'   => $group_title,
    				'type'   => 'group',
    				// List of child fields
    				'fields' => self::$text_block
    		);
    		return $returnArray;
    	}
    	
    	static function create_text_block_group($box_prefix, $group_title){
    		$returnArray = array(
    				'id'     => $box_prefix  . 'text_block',
    				'name'   => $group_title,
    				'type'   => 'group',
    				// List of child fields
    				'fields' => self::$text_block
    		);
    		return $returnArray;
    	}
    }
    ?>

    BUYING FIELDS -the custom fields for the buying page.

    <?php
    require_once(CUSTOM_FIELDS.'/field-modules.php');
    add_filter( 'rwmb_meta_boxes', 'BUYING_FIELDS_register_meta_boxes' );
    
    function BUYING_FIELDS_register_meta_boxes( $meta_boxes )
    {	
    	$box_prefix = 'BUYING_OPTIONS_';
    	$meta_boxes[] = array(
    		'title'      => 'buying options',
    		'post_types' => array( 'page' ),
    		'include' => array( 
    			'template' => array( 'page-buying.php'),
    		),
    		'fields' => array(
    			Field_modules::create_text_block_group($box_prefix, 'intro'),
    			Field_modules::create_tiles_group($box_prefix, 'buying option 1', '1'),
    			Field_modules::create_tiles_group($box_prefix, 'buying option 2', '2'),
    			Field_modules::create_tiles_group($box_prefix, 'buying option 3', '3'),
    		),
    	);
    	
    	$box_prefix = 'BUYING_SHIPPING_';
    	$meta_boxes[] = array(
    		'title'  => 'shipping',
    		'post_types' => array( 'page' ),
    		'include' => array( 
    			'template' => array( 'page-buying.php'),
    		),
    		'fields' => array(
    			Field_modules::create_text_block_group($box_prefix, '#'),
    		),
    	);
    	
    	$box_prefix = 'BUYING_DEALERS_';
    	$meta_boxes[] = array(
    		'title'  => 'dealers',
    		'post_types' => array( 'page' ),
    		'include' => array( 
    			'template' => array( 'page-buying.php'),
    		),
    		'fields' => array(
    			Field_modules::create_tiles_group($box_prefix, 'massachusetts dealers', '1'),
    			Field_modules::create_tiles_group($box_prefix, 'out of state dealers', '2'),
    		),
    	);
    	
        return $meta_boxes;
    }
    ?>
    #1097
    Anh TranAnh Tran
    Keymaster

    Hi, I think there must be some JS errors which prevent the editor to be rendered properly. Do you see any errors in browser console?

    #1107
    billing@archcreativegroup.com[email protected]
    Participant

    I didn't think to check. Let me take a gander.

    Oh I should add that this ONLY occurs when using groups, otherwise I can have multiple WSYIWYG editors that all render correctly.

    #1114
    Anh TranAnh Tran
    Keymaster

    I see, I will check with the group extension also. Please let me know about the JS error in console if you find anything.

    #1118
    billing@archcreativegroup.com[email protected]
    Participant

    Nothing in the console related to wordpress/metabox...
    I'm going to try and cut and paste your code from the site, try to use multiple wysiwyg editors and see how that goes.

    #1119
    billing@archcreativegroup.com[email protected]
    Participant

    I just tried to cut and paste the sample code from the documentation for groups. Setting that to display on all pages.

    I have found that, while it is possible to have two or more wysiwygs within the same group, if there is a wysiwyg in a subsequent group in the same meta box.. or even in another meta box, it will not render correctly.

    however!

    When I used your documentation code nearly verbatim, I had it display on all pages, it displays below my original boxes.

    In that meta box that your code creates, there are two groups. In the first the wsyiwyg boxes do render correctly. In the second they fail to render correctly.

    I honestly have no idea what is occurring. The rendering behavior seems very sporadic.

    #1126
    Anh TranAnh Tran
    Keymaster

    Hmm, that's unexpected and weird behaviour. I'm fixing it and will update asap.

    #1129
    billing@archcreativegroup.com[email protected]
    Participant

    Oh, ok so it is a bug then?

    Just as long as I know!

    I get so paranoid that I might have implemented it wrong haha.

    I appreciate your help Anh.

    #1235
    billing@archcreativegroup.com[email protected]
    Participant

    Any progress on this one Anh?

    I'll have to try a different approach for my project if the wysiwyg is broken...
    Obviously you don't have to work on my timeline =)

    Would just like to know where you're at so I can act accordingly.

    Thanks!

    #1240
    Anh TranAnh Tran
    Keymaster

    I'm debugging the problem but haven't solved it yet. Give me more 3 days so I can dig deeper into each line of code.

    #1242
    Anh TranAnh Tran
    Keymaster

    Hi again, I've setup again some test cases for this problem and now it looks fine to me:

    Very weird 🙁

    #1293
    Anh TranAnh Tran
    Keymaster

    Hi, do you see any errors? As I posted on previous reply, it works just fine for me.

Viewing 12 posts - 1 through 12 (of 12 total)
  • The topic ‘WSYIWYG seems to be broken when using groups’ is closed to new replies.