Text editor for custom field in joomla

女生的网名这么多〃 提交于 2019-12-12 03:17:54

问题


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" 
        />


来源:https://stackoverflow.com/questions/8895052/text-editor-for-custom-field-in-joomla

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!