I am trying to build a custom field in drupal 7. evrything work just fine, except from the wysiwyg field. I am using the next code to build an WYSIWYG element:
$element['my_body'] = array(
'#title' => t('Editor'),
'#type' => 'text_format',
'#tree' => true,
'#rows' => 20,
'#format' => 'filtered_html',
);
When its not wysiwyg (regular textarea) all save go fine, but after i change it to text_format, drupal get the value of the field as array with 2 keys (value and format), and that's make an error while drupal save the values of the field. As much as i understnad it, what drupal expect to get is two deferent values (of body_filter and format) and not an body_filter array with 2 keys (value and format).
Anyone can give me a hint how to solve this issue (can't find anything relevant in google and drupal.org)?
Thanks.