I'm adding a new token which formats the submission values into a table. I can see what somewhere, Webforms calls

function theme_webform_display_time($variables) {

to format the time, but I can't see any example of this.

Is there anyway to manually call this function?

Comments

quicksketch’s picture

Status: Active » Fixed

The _webform_display_time() function sets the #theme property of "webform_display_time", which ultimately means theme_webform_display_time() will get called (unless overridden by the site theme).

I'm not sure what variables you're starting with at the point where you want to render out a time component, but generally you'd do something like this:

$format = 'html'; // Either "html" or "text".
$element = webform_component_invoke('time', 'display', $component, $value, $format);
$output = drupal_render($element);

The call to drupal_render() checks the #theme property, which calls the theme function. Yeah I know it's crazy abstracted, but that's just the Drupal form and rendering system.

This question is generally kind of out scope for the Webform, as it's a custom coding question, so I'm going to mark this issue fixed directly.

Status: Fixed » Closed (fixed)

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