本文介绍了joomla中自定义字段的文本编辑器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我已经在Joomla 1.5菜单中创建了一个自定义字段来描述菜单.我已经在administrator\components\com_menus\models\metadata
中编辑了 component.xml ,但是现在我想使用文本编辑器代替普通的文本框.有什么想法可以解决这个问题吗?
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?
推荐答案
您需要创建一个编辑器类型的元素.
You need to create an element of editor type.
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') ) ;
}
}
您可以在xml中将其用作
And you can use this in xml as
<param name="custom_param"
width="300"
height="150"
type="myeditor"
label="LABEL"
description="DESC"
/>
这篇关于joomla中自定义字段的文本编辑器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!