Availability: >= 3.0

Type: Object Property

Description: Overwrites the styles menu with a new menu.


$editor->stylesMenu = array $styles;

The value should be set to an associative array where the key is the style tag and the value is the label to appear on the menu.

The style tag should be an HTML tag name followed by optional attributes. When this item is selected from the menu it will wrap the selection in the specified tag and add the specified attributes. The special tag name of *block* indicates that the attributes should be applied to any block level element rather than a specific one. If the tag is an object such as an image it will apply the attributes to the selected image. Only styles that can be applied to the current selection will appear in the menu at any time, so image styles will only display if an image is selected.

Setting this property will overwrite the existing menu with a new one. To manipulate the existing menu see addStyle, removeStyle, clearStylesMenu


$editor->stylesMenu = array(    
'p' => 'Paragraph',
'p class="warning"' => 'Warning Box'
=> 'Heading 1',
'h2' => 'Heading 2',
'code' => 'Generic Code Example',
'code class="php"' => 'PHP Code Example',
'cite' => 'Citation',
'blockquote' => 'Quote'

See also:

addStyle, removeStyle, clearStylesMenu