2012-01-17 61 views
0

我在Joomla 1.5菜單中創建了一個自定義字段來描述菜單。我編輯了component.xml in administrator\components\com_menus\models\metadata,但現在我想將文本編輯器替換爲普通文本框。任何想法如何處理這個?joomla中自定義字段的文本編輯器

回答

0

您需要創建編輯器類型的元素。

Learn how to create elementhow 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')) ; 
    } 
} 

而且你可以在XML以此爲

<param name="custom_param" 
     width="300" 
     height="150" 
     type="myeditor" 
     label="LABEL" 
     description="DESC" 
     /> 
+0

對不起,我沒有解釋它正確我已經爲每個參數(系統)的添加一個額外字段菜單項這是代碼 \t'' 我想要一個文本編輯器,這是有一種方法,我已經搜查,但沒有得到任何東西 – swap 2012-01-18 10:09:48

+0

我改變了我的答案。 – Gaurav 2012-01-18 10:28:13

+0

謝謝你會試試這個 – swap 2012-01-18 11:45:41

相關問題