I have created a custom field in Joomla 1.5 menu for description of the menu. I have edited the component.xml in administrator\components\com_menus\models\metadata
but now I want to put a text editor in place of a normal text-box. Any ideas how to approach this?
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
You need to create an element of editor type.
Learn how to create element and how to save data
class JElementMyeditor extends JElement
{
var $_name = 'Myeditor';
/**
* @param $name
* @param $value
* @param $node
* @param $control_name
*/
function fetchElement($name, $value, &$node, $control_name)
{
$editor = JFactory::getEditor();
$width = $node->attributes('width');
$height = $node->attributes('height');
$col = $node->attributes('col');
$row = $node->attributes('row');
// ($name, $html, $width, $height, $col, $row, $buttons = true, $params = array())
return $editor->display($control_name.'['.$name.']',
htmlspecialchars($value, ENT_QUOTES),
$width, $height, $col, $row,
array('pagebreak', 'readmore') ) ;
}
}
And you can use this in xml as
<param name="custom_param"
width="300"
height="150"
type="myeditor"
label="LABEL"
description="DESC"
/>