2011-05-16 46 views
1

我創造了我自己的模塊形式,其中包括地址textarea的CKEditor的使用Drupal自定義表單

$form['address'] = array(
    '#input_format' => '1', 
    '#rows' => '5', 
    '#weight' => '4', 
    '#type' => 'textarea', 
    '#title' => t('Address'), 

); 

當我跑我得到下面的下面的幫助形式,它

的CKEditor:該ID爲排除或包含此元素是customers/edit/5.edit-address。

,所以我得到了元素的ID,並在CKEditor的

但仍然編輯器不會在這一領域出現,我失去的東西的包括設置輸入呢?

回答

3

使用#type of「text_format」和#base_type爲「textarea」,它應該工作。像這樣:

$form['address'] = array(
     '#input_format' => '1', 
     '#rows' => '5', 
     '#weight' => '4', 
     '#type' => 'text_format', 
     '#base_type' => 'textarea', 
     '#title' => t('Address'), 

); 
+0

我做了你說的,但編輯沒有出現,仍然是相同的textarea,任何其他建議? – 2011-05-18 05:40:32

+0

我使用WYSIWYG模塊來滿足我所有的需求。這樣我就可以將編輯器附加到過濾的HTML文本格式。因此,當您使用帶有#type參數'text_format'的此文本字段時,它會爲您提供已篩選或完整HTML選項(默認情況下),從而顯示編輯器。 – Donnyboy 2011-05-18 09:03:38

+0

我依稀記得一個'#wysiwyg'=> true'選項可能會幫助,但很難搜索它。在ckeditor [here](http://drupal.org/node/824822#comment-3089648)中有一個引用來支持它,在將它設置爲false以防止ckeditor出現的情況下,所以也許將它設置爲true會幫你。 – 2011-05-18 14:13:41