Top of Page
Top of page

Editor Parameter Element

Parameter elements include many different input types. The text type provides a textarea where one could enter raw HTML, but since Joomla! has a built-in method for calling a WYSIWYG editor...why not use it?

<params addpath="path/to/folder/elements">
 ...
 <param type="editor" name="myparam" label="HTML Editor" description="Use the editor" default="HTML Goes Here" />
 ...
</params>
editor.php:
 
<?php
// Check to ensure this file is within the rest of the framework
defined('JPATH_BASE') or die();
 
class JElementEditor extends JElement
{
  var $_name = 'editor';
 
  function fetchElement($name, $value, &$node, $control_name)
  {
    $value = str_replace('
', "\n", $value);
    $editor =& JFactory::getEditor();
    return $editor->display( $control_name.'['.$name.']', 
      $value, '80%', '400', '40', '15', null ) ;
  }
}
 
 

Downloads

RicheyWeb Extensions have been downloaded 9313 times. 3 donations have been made for a total of $27.50.