I have added the following code to functions.php (adapted from news module)
function &yellow_getWysiwygForm($caption, $name, $value = '', $width = '100%', $height = '400px', $supplemental='')
{
$editor = false;
$x22=false;
$xv=str_replace('XOOPS ','',XOOPS_VERSION);
if(substr($xv,2,1)=='2') {
$x22=true;
}
$editor_configs=array();
$editor_configs['name'] =$name;
$editor_configs['value'] = $value;
$editor_configs['rows'] = 35;
$editor_configs['cols'] = 60;
$editor_configs['width'] = '100%';
$editor_configs['height'] = '400px';
switch(strtolower(yellow_getmoduleoption('form_options'))) {
case 'spaw':
if(!$x22) {
if (is_readable(XOOPS_ROOT_PATH . '/class/xoopseditor/spaw/formspaw.php')) {
include_once(XOOPS_ROOT_PATH . '/class/xoopseditor/spaw/formspaw.php');
$editor = new XoopsFormSpaw($caption, $name, $value);
}
} else {
$editor = new XoopsFormEditor($caption, 'spaw', $editor_configs);
}
break;
case 'fck':
if(!$x22) {
if ( is_readable(XOOPS_ROOT_PATH . '/class/xoopseditor/FCKeditor/formfckeditor.php')) {
include_once(XOOPS_ROOT_PATH . '/class/xoopseditor/FCKeditor/formfckeditor.php');
$editor = new XoopsFormFckeditor($caption, $name, $value);
}
} else {
$editor = new XoopsFormEditor($caption, 'fckeditor', $editor_configs);
}
break;
case 'htmlarea':
if(!$x22) {
if ( is_readable(XOOPS_ROOT_PATH . '/class/xoopseditor/htmlarea/formhtmlarea.php')) {
include_once(XOOPS_ROOT_PATH . '/class/xoopseditor/htmlarea/formhtmlarea.php');
$editor = new XoopsFormHtmlarea($caption, $name, $value);
}
} else {
$editor = new XoopsFormEditor($caption, 'htmlarea', $editor_configs);
}
break;
case 'dhtml':
if(!$x22) {
$editor = new XoopsFormDhtmlTextArea($caption, $name, $value, 10, 50, $supplemental);
} else {
$editor = new XoopsFormEditor($caption, 'dhtmltextarea', $editor_configs);
}
break;
case 'textarea':
$editor = new XoopsFormTextArea($caption, $name, $value);
break;
case 'tinyeditor':
if ( is_readable(XOOPS_ROOT_PATH.'/class/xoopseditor/tinyeditor/formtinyeditortextarea.php')) {
include_once XOOPS_ROOT_PATH.'/class/xoopseditor/tinyeditor/formtinyeditortextarea.php';
$editor = new XoopsFormTinyeditorTextArea(array('caption'=> $caption, 'name'=>$name, 'value'=>$value, 'width'=>'100%', 'height'=>'400px'));
}
break;
case 'koivi':
if(!$x22) {
if ( is_readable(XOOPS_ROOT_PATH . '/class/xoopseditor/formwysiwygtextarea.php')) {
include_once(XOOPS_ROOT_PATH . '/class/xoopseditor/formwysiwygtextarea.php');
$editor = new XoopsFormWysiwygTextArea($caption, $name, $value, '100%', '450px', '');
}
} else {
$editor = new XoopsFormEditor($caption, 'koivi', $editor_configs);
}
break;
}
return $editor;
}
function yellow_getmoduleoption($option, $repmodule='yellow_module')
{
global $xoopsModuleConfig, $xoopsModule;
static $tbloptions= Array();
if(is_array($tbloptions) && array_key_exists($option,$tbloptions)) {
return $tbloptions[$option];
}
$retval = false;
if (isset($xoopsModuleConfig) && (is_object($xoopsModule) && $xoopsModule->getVar('dirname') == $repmodule && $xoopsModule->getVar('isactive'))) {
if(isset($xoopsModuleConfig[$option])) {
$retval= $xoopsModuleConfig[$option];
}
} else {
$module_handler =& xoops_gethandler('module');
$module =& $module_handler->getByDirname($repmodule);
$config_handler =& xoops_gethandler('config');
if ($module) {
$moduleConfig =& $config_handler->getConfigsByCat(0, $module->getVar('mid'));
if(isset($moduleConfig[$option])) {
$retval= $moduleConfig[$option];
}
}
}
$tbloptions[$option]=$retval;
return $retval;
}
and xoops_version.php with
/**
* Editor to use
*/
$modversion['config'][37]['name'] = 'form_options';
$modversion['config'][37]['title'] = "_MI_YELLOW_FORM_OPTIONS";
$modversion['config'][37]['description'] = '_MI_YELLOW_FORM_OPTIONS_DESC';
$modversion['config'][37]['formtype'] = 'select';
$modversion['config'][37]['valuetype'] = 'text';
$modversion['config'][37]['options'] =
array( _MI_YELLOW_FORM_DHTML=>'dhtml',
_MI_YELLOW_FORM_COMPACT=>'textarea',
_MI_YELLOW_FORM_SPAW=>'spaw',
_MI_YELLOW_FORM_HTMLAREA=>'htmlarea',
_MI_YELLOW_FORM_KOIVI=>'koivi',
_MI_YELLOW_FORM_FCK=>'fck',
_MI_YELLOW_FORM_TINYEDITOR=>'tinyeditor'
);
$modversion['config'][37]['default'] = 'dhtml';
updated the module and changed submit.php
//$modlinkform->addElement(new XoopsFormDhtmlTextArea(_MD_DESCRIPTIONC , 'moddesc' , null , 8, 50), false);
$editor=yellow_getWysiwygForm(_MD_DESCRIPTIONC, 'moddesc', $moddesc, 15, 60, 'moddesc_hidden');
$modlinkform->addElement($editor,true);
The form displayed fine with the selected editor but the data was not saved to the database.
any help please
Thanks