When creating or editing a Markup component in a Webform, WYSIWYG (with TinyMCE 3) ignores the value field and instead creates an editor around the token help. I tried removing token help from the Markup component, and instead WYSIWYG created an editor around the Input Type selector...!

Not sure if this should be addressed here or in the WYSIWYG bug queue, but for now I'm posting it here.

Comments

chromix’s picture

I should also note I'm using the latest version of WYSIWYG and TinyMCE. I've also posted this in the WYSIWYG bug queue:
http://drupal.org/node/381174

sun’s picture

Hm. Webform should produce the same output like filter_form() would. I did not try to replicate this issue, but from the description it sounds like it does not.

quicksketch’s picture

Version: 5.x-2.6 » 6.x-2.7

Seems that this is still the case even in 6.x and the latest Webforms. I haven't seen WYSIWYG "create an editor around the token help", but it doesn't create an editor at all and may through a JS error. My guess is that Webform doesn't group the textarea and the input format in a dedicated grouping of fields in the FAPI array, which throws off WYSIWYG somehow.

ashley.maher@didymodesigns.com.au’s picture

Thanks for adding this. I thought I was going nuts.

Drupal-6-12
WYSIWYG-6.x-2.0
TInyMCE-3.2.4.1
WebForm-6.x-2.7

There is no formatting ability in the form element area at all. No WYSIWYG, when I use html to set out paragraphs the tags are stripped.

Ideas for temporary hacks to get around this great fully received.

Regards,

Ashley

mrfelton’s picture

subs

awolfey’s picture

subscribe
Experiencing this with fck.

awolfey’s picture

I was able to get this to work by patching markup.inc.

I put a grouping "['markup']" around the markup ['value'] and the filter ['format'].

I'm not sure what else this might break.

Can provide a patch if desired.

function _webform_edit_markup($currfield) {
  $edit_fields = array();
  $edit_fields['advanced']['mandatory'] = array(); // Do not render the mandatory checkbox.
  $edit_fields['markup']['value'] = array(
    '#type' => 'textarea',
    '#title' => t('Value'),
    '#default_value' => $currfield['value'],
    '#description' => t('Markup allows you to enter custom HTML or PHP logic into your form.'). theme('webform_token_help'),
    '#weight' => -1,
  );
  // Add the filter form.
  $edit_fields['markup']['format'] = filter_form($currfield['extra']['format'], 0, array('extra', 'format'));

  // No description for markup.
  $edit_fields['extra']['description'] = array();

  return $edit_fields;
}
awolfey’s picture

This will also be needed in webform_components.inc

In function webform_component_update($component) add this

  if (isset($component['markup']['value'])) {
    $component['value'] = $component['markup']['value'];
  }

above this line.

  $component['value'] = isset($component['value']) ? $component['value'] : NULL;

In function webform_component_insert($component)

add

  if (isset($component['markup']['value'])) {
    $component['value'] = $component['markup']['value'];
  }

above this line.

  $component['value'] = isset($component['value']) ? $component['value'] : NULL;

Sorry for no patch. Will get around to it.

Basically, we are wrapping the field and format filter together for markup editing. Then we remove the wrapper before saving the form component so the display and component list works.

sun’s picture

@awolfey: Can you provide a proper patch?

awolfey’s picture

Ummmm. Don't try this yet...

awolfey’s picture

I made edits to #8 that should work. However, this is largely untested, so use at own risk.

I am slammed at the moment, but I will get a patch rolled tonight or tomorrow morning. (Patching not my strong suit.)

awolfey’s picture

Status: Active » Needs review
StatusFileSize
new3.47 KB

Here is a patch. It is working for me, but I haven't tested it thoroughly.

jhodgdon’s picture

Just a note that WYSIWYG will put an HTML editor on any text area field that is immediately followed by an input format field named 'format', and these two fields have to be in the same level of the array.

So I think it would be better just to move the input format up to the next level of the array, rather than moving both of them into 'markup' part of the array, since that obviously resulted in some hacking being necessary farther down in the patch.

sun’s picture

+++ components/markup.inc	6 Aug 2009 00:05:40 -0000
@@ -34,7 +34,7 @@
-  $edit_fields['value'] = array(
+  $edit_fields['markup']['value'] = array(
     '#type' => 'textarea',
     '#title' => t('Value'),
     '#default_value' => $currfield['value'],

Simply define

'#parents' => array('value'),

here and you can remove the other changes - in the insert handler.

This review is powered by Dreditor.

hepabolu’s picture

I get the impression I need this patch, but I'm not proficient enough in PHP to understand the comments made in #14 to apply them to (what seems to be) the patch provided in #12. Could someone please elaborate or update the patch?

Thank you.

jim kirkpatrick’s picture

#12 + #14 works for me too...

@Hepabolu: the '#parents' => array('value'), line goes directly under the '#default_value' => $currfield['value'], line, or around line 41 of markup.inc.

quicksketch’s picture

Version: 6.x-2.7 » 6.x-2.9
Status: Needs review » Fixed
StatusFileSize
new1.18 KB

I've committed the attached patch to all branches.

roball’s picture

Yeah, just tested it and can confirm this works fine now. Thanks!

quicksketch’s picture

Thanks again roball. Everyone using the 2.x branch, I'll be putting out a 2.10 version once we finally get some resolution over in #604958: %profile and %server default values broken.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.