I have a webform-results table where the contents of some text area columns could be quite large. I would like to truncate the content to maybe 200 characters, but for textarea and textfield components the return values are passed directly.

/**
 * Implementation of _webform_table_component().
 */
function _webform_table_textarea($component, $value) {
  return empty($value[0]) ? '' : check_plain($value[0]);
}

The value should be run through a theme function. This could then be overridden by end users.

Comments

quicksketch’s picture

I agree, these should run through theme functions. Patches appreciated. :-)

carinadigital’s picture

StatusFileSize
new1.59 KB

I've added a simple patch to change textfield and textarea components to run through a common theme function that can be overriden.

I've struggled to work out a generic theme implementation for component tables. Maybe the _webform_table hook itself should be a theme function with a preprocess as it's only displaying the same data but in a different view?

quicksketch’s picture

I think the most logical solution would be a separate theme function for every component, similar to how we have separate theme functions for displaying in e-mail.

carinadigital’s picture

I think you're right. It's the webform component developers that should create appropriate default theme functions.
I'll try to submit a patch for the core components.

carinadigital’s picture

Version: 6.x-3.2 » 6.x-3.4
StatusFileSize
new2.07 KB

I've added a patch against webform-6.x-3.4 to add table theme override functions for textfield and textarea components. They're limited to 20 chars by default, and then theme overridable in the normal way.
I'm not sure the other default components need theme functions as their values won't be that long.

danchadwick’s picture

Issue summary: View changes
Status: Active » Closed (won't fix)

There won't be further feature development in the X.x-3.x branches.