Posted by nidhijsen on January 18, 2011 at 1:20pm
11 followers
Jump to:
| Project: | CKEditor - WYSIWYG HTML editor |
| Version: | 7.x-1.0 |
| Component: | Documentation |
| Category: | task |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | active |
| Issue tags: | #d7ux, ckeditor-7.x, D7 |
Issue Summary
I am using Drupal 7.0 and I needed to display CK editor inside a text-area.In Drupal 6 there is option to display the textarea using visibility settings.But in Drupal 7 there is no such option.So how can i bring the CK editor inside the text-area in drupal 7?.I have installed CK editor module 7.x-1.x-dev.Any help is very much appreciated.Thank you
Comments
#1
Do you use any type of text format (input format) in this textarea?
#2
I got this problem fixed..
I just typed the following code in my form for the text-area field.
'#type' => 'text_format'
Then the ckeditor was displayed inside the textarea with the default 'Text format' selected(I am using 'full html').
I hope this helps someone.
Thank you.
#3
Instead of this u could add:
'#format' => 'full_html'Then CKEditor should work too and attach to this textarea.
Greetings
#4
Hi,
sorry for posting in already closed thread. I have the same issue as above while making the switch from D6 to D7. I use an own module with a simple textarea form and ckeditor does not show up.
I tried setting the mentioned parameters:
'#format' => 'full_html' -> does not show up
'#type' => 'text_format' -> gives me the select box below the textarea but ckeditor still does not show up
Also I tried some more (not well in API documented) parameters like:
'#input_format' => 'xyz' -> no result even the filter format is defined. And a call of filter_default_format() gives me the expected result
I also played with:
'#text_format' => 'xyz' -> even no result.
Ckeditor itself is working as expected in all other textareas like body_field and contact and so on, just my own simple defined textarea form which did it flawless in D6 is no longer working...
Any ideas?
Thanks!
cheers bzrudi
#5
Hi,
nevermind, it works with a clean install of D7. So it seems its an problem with the update and the used filters or whatever, will get rid of it ;-)
Thanks anyway
#6
Here's an exact syntax taken from my custom module:
$form['formItem'] = array('#type'=>'text_format',
'#title' => t('Field Label'),
'#value' => 'This is my value',
'#format'=>'full_html',
);
Where "full_html" is the id of the Text format.
Cheers.
#7
Automatically closed -- issue fixed for 2 weeks with no activity.
#8
Last comment deleted.
#9
#10
The code below works for:
<?php
/**
* Implementation of hook_form_alter()
*/
function mymodule_form_alter(&$form, &$form_state, $form_id) {
// Add a dummy textarea to get the WYSIWYG editor loaded
if($form_id == 'panels_edit_display_form' || $form_id == 'panels_panel_context_edit_content') {
$form['dummy'] = array(
'#type' => 'text_format',
'#title' => 'test',
'#prefix' => '<div style="display:none;">',
'#suffix' => '</div>',
);
}
// Modify the submit handler of the popup to save TinyMCE display to hidden textarea
elseif ($form_id == 'ctools_custom_content_type_edit_form') {
$form['buttons']['return']['#attributes'] = array('onclick' => 'tinyMCE.triggerSave(true,true);');
}
}
?>
#11
hi,
i'm using this code, ckeditor appears ok, but when i save i get this error:
Warning: htmlspecialchars() expects parameter 1 to be string, array given in check_plain() (line 1552 of includes\bootstrap.inc).Do you know why? The form is always empty
<?php$form['ite_details_home']['ite_details_text'] = array(
'#type'=>'textarea',
'#title' => 'Texto',
'#default_value' => variable_get('ite_details_text', ''),
'#type' => 'text_format'
/*'#format' => 'full_html',*/
);
?>
#12
Same for me, it returns an array for some reason. Although, you are specifying #type twice...
UPDATE: the value saved for #text_format is indeed an array containing keys for 'value' and 'format'.
#13
opening it...
#14
Warning: htmlspecialchars() expects parameter 1 to be string, array given in check_plain() (line 1552 of includes\bootstrap.inc).
Have the same problem
#15
this just sucks! it does not show up, what I need to do, delete all the files, what a bout database?
#16
I used the following code to get an editor up on a profile field "field_profile_about":
function mymodule_form_alter(&$form, &$form_state, $form_id) {if($form_id=='user_profile_form'){
$form['field_profile_about']['und'][0]['#base_type'] = 'textarea';
unset($form['field_profile_about']['und'][0]['#columns'][1]);
$form['field_profile_about']['und'][0]['#default_value'] = $form['field_profile_about']['und'][0]['value']['#default_value'];
$form['field_profile_about']['und'][0]['#type'] = 'text_format';
$form['field_profile_about']['und'][0]['#format']= 1; //filtered, no image insertion, imce doesnt work
}
}
css:
fieldset#edit-field-profile-about-und-0-format .fieldset-wrapper {
display:none;
}
#17
$form['formItem'] = array(
'#type'=>'text_format',
'#title' => t('Field Label'),
'#value' => 'This is my value',
'#format'=>'full_html',
);
yes! It works. Thnks petrica