Actions

Difference between revisions of "JFactory/getEditor"

From Joomla! Documentation

m (Tidied up a little.)
Line 16: Line 16:
 
|}
 
|}
 
===Example===
 
===Example===
In this example, the current editor is returned.  TODO: Need a better example.
 
<source lang="php">
 
$editor =& JFactory::getEditor();
 
</source>
 
 
===Display Example===
 
 
In this example, you can see how to display the editor and send specific display parameters.
 
In this example, you can see how to display the editor and send specific display parameters.
 
<source lang="php">
 
<source lang="php">
 
$editor =& JFactory::getEditor();
 
$editor =& JFactory::getEditor();
$params = array('smilies'=> '0' ,
+
$params = array( 'smilies'=> '0' ,
'style'=> '1' ,   
+
'style' => '1' ,   
'layer'=> '0' ,  
+
'layer' => '0' ,  
'table'=> '0' ,
+
'table' => '0' ,
'clear_entities'=>'0'
+
'clear_entities'=>'0'
);
+
);
echo $editor->display("desc",'','400','400','20','20', false ,$params);
+
echo $editor->display( 'desc', '', '400', '400', '20', '20', false, $params );
 
</source>
 
</source>
 +
For a complete list of parameters that can be passed to the TinyMCE editor, see the Joomla source file: ''/plugins/editor/tinymce.php''.
 
===See also===
 
===See also===
 
* [http://api.joomla.org/Joomla-Framework/JFactory.html#getEditor JFactory->getEditor on api.joomla.org]
 
* [http://api.joomla.org/Joomla-Framework/JFactory.html#getEditor JFactory->getEditor on api.joomla.org]
 
* [[JEditor]]
 
* [[JEditor]]
 
<noinclude>[[Category:Development]][[Category:Framework]][[Category:JFactory]]</noinclude>
 
<noinclude>[[Category:Development]][[Category:Framework]][[Category:JFactory]]</noinclude>
* Joomla source file::  /plugins/editor/tinymce.php '''for complete list of parameters'''
 

Revision as of 10:34, 27 May 2009

Returns a reference to the global editor object, only creating it if it doesn't already exist. The object returned will be of type JEditor.

Syntax

object JEditor getEditor( $editor )

where:

Argument Data type Description Default
$editor string The name of the editor (for example, 'tinymce'). If null then the current editor will be returned. null

Example

In this example, you can see how to display the editor and send specific display parameters.

$editor =& JFactory::getEditor();
$params = array( 'smilies'=> '0' ,
                 'style'  => '1' ,  
                 'layer'  => '0' , 
                 'table'  => '0' ,
                 'clear_entities'=>'0'
                 );
echo $editor->display( 'desc', '', '400', '400', '20', '20', false, $params );

For a complete list of parameters that can be passed to the TinyMCE editor, see the Joomla source file: /plugins/editor/tinymce.php.

See also