0

我在 Joomla 1.5 菜单中创建了一个自定义字段来描述菜单。我已经编辑了component.xmladministrator\components\com_menus\models\metadata但现在我想用一个文本编辑器代替普通的文本框。任何想法如何解决这个问题?

4

1 回答 1

0

您需要创建一个编辑器类型的元素。

了解如何创建元素以及如何保存数据

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 中使用它作为

<param  name="custom_param" 
        width="300" 
        height="150"
        type="myeditor" 
        label="LABEL"  
        description="DESC" 
        />
于 2012-01-18T09:20:52.907 回答