[wp-hackers] class Attribute for iFrame Tag in TinyMCE

Frank Bueltge frank at bueltge.de
Wed Sep 5 10:00:20 UTC 2012


Hello at all.
I have allowed the iframe tag for the editor via follow source, see
below. But the class attribute is in the current stable and nightly
build not possible, always was killed.
Maybe is this an bug or an feature? Give it an filter for deactivate
the functinos, that remove all class attributes after an switch from
html to visual mode.
Thanks for your time and help!

add_filter( 'tiny_mce_before_init', 'fb_change_mce_options' );
function fb_change_mce_options( $arr ) {
	
	// Comma separated string od extendes tags
	// Command separated string of extended elements
	$ext = 'iframe[id|class|title|style|align|frameborder|height|longdesc|marginheight|marginwidth|name|scrolling|src|width]';
	
	if ( isset( $arr['extended_valid_elements'] ) )
		$arr['extended_valid_elements'] .= ',' . $ext;
	else
		$arr['extended_valid_elements'] = $ext;

	var_dump( $GLOBALS['allowedposttags'] );
	
	var_dump($arr);
	
	return $arr;
}

i have check the allowedposttags var. This var don't have the new tag
iframe after my additional. But also an enhancement of this var have
no results for the class attribute. With other attributes works fine,
like frameborder.

	$GLOBALS['allowedposttags']['iframe'] = array(
			"id" => TRUE,
			"class" => array(),
			"title" => TRUE,
			"style" => TRUE,
			"align" => TRUE,
			"frameborder" => TRUE,
			"longdesc" => TRUE,
			"marginheight" => TRUE,
			"marginwidth" => TRUE,
			"name" => TRUE,
			"scrolling" => TRUE,
			"src" => TRUE,
			"height" => TRUE,
			"width" => TRUE
	);

Best regards
frank


More information about the wp-hackers mailing list