Markup fields only ever appear in form format, they never appear in html/text format.

This is due to:

 * Implements _webform_display_component().
function _webform_display_markup($component, $value, $format = 'html') {
  return array();

In _webform_client_form_add_component() when the $format is html or text (i.e. not form) markup components are never added because _webform_display_markup() returns an empty array. There is no way to override this, and as such no way to have markup fields output in html/text.

Members fund testing for the Drupal project. Drupal Association Learn more


fenstrat’s picture

Status: Active » Needs review
416 bytes

The attached patch removes _webform_display_markup(). Removing it has no effect on current functionality, i.e. markup fields are still no rendered in html/text output. However removing it allows a custom module to implement it and return valid markup for display.

I admit this is a very crude solution, using a custom module to implement a private hook on behalf of a core webform component. However I couldn't see any other straight forward way to allow markup fields to be displayed in html/text. Any ideas on how to achieve it in a less hacky way? I'd be more than to work on it.

quicksketch’s picture

Status: Needs review » Needs work

However removing it allows a custom module to implement it and return valid markup for display.

Instead what we should do is keep the implementation but provide a theme function inside of it (which defaults to not rendering anything). Then both themes and modules can provide the missing information without hijacking the namespace of another module.

fenstrat’s picture

Status: Needs work » Needs review
1.38 KB

Theme function approach attached. Thanks for the heads up, should have done this from the start, brain fade on my account.

Also, think I've asked you this before @quicksketch, but is there a reason you're not using Git attribution? It's just that it provides a nice kickback for those contributing patches. Thanks!

quicksketch’s picture

Also, think I've asked you this before @quicksketch, but is there a reason you're not using Git attribution?

Considering when I'm reviewing patches like today and yesterday, I can review and commit 25 patches in a single day, I don't want to have to look up everyones e-mail address. Additionally Eclipse doesn't support applying patches while maintaining attribution, so the whole thing is a big hassle. If you'd like to get attribution, I'd be fine with switching to a more optimal method if I can find one (I just really like applying patches from the clipboard with Eclipse). However to save maintainers the work, it would be helpful to format your patches with git am, instead of git diff, that way the attribution is included in the patch itself and I don't have to look it up.

quicksketch’s picture

Though actually I'd be happy to make you a co-maintainer if you're interested. ;)

All your patches have been been spot on and it would be great to have more eyes in the queue.

fenstrat’s picture

Wow, I'm honoured @quicksketch. Thank you for the offer. Given we have an ongoing project largely built on webform (yet to launch) I'd loved to help out here in the queue. So sure, sign me up ... famous last words!

With attribution I fully appreciate your workload. Something else to keep in mind is Dreditor which has a nifty little "Create commit message" feature in issues which handles the --author attribution automatically.

quicksketch’s picture

Status: Needs review » Reviewed & tested by the community

Yay! What a wonderful surprise. Maintainers are so hard to come by. :D :D

I've added you as a maintainer to the project. How about you commit this to the 4.x branch?

fenstrat’s picture

Status: Reviewed & tested by the community » Fixed

Committed to 4.x in 6a98aa1.

Cheers @quicksketch! I look forward to working with you to keep up the great work on webform.

Status: Fixed » Closed (fixed)

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

simone960’s picture

I'm using 7.x-4.0-alpha8, I suppose your patch already applied to it. However, I still failed to display the markup in HTML format, I couldn't even save the html format.

What strange to me is that, this works perfectly in my local PC (I can save and display markup in HTML) but not on web hosting, is there any setting to be done over on the hosting? I'm using WYSIWYG + CKEditor. Please advise.

jim.moses’s picture


Any way on how to display markups in form view? I'm using 7.x-4.0-alpha10 and want the markups to be displayed on the pdf I generate from the forms as well. Kindly help. Thanks