This bug is made by the functions webform_theme() and webform_load_components().
I posted the relevant code below and marked the critical parts with '// <=='.

Function webform_theme() calls webform_load_components() and gets an array with the names of the components as key and the localised names as value. The problem is that webform_theme() uses the localised version but there is no function called _webform_theme_localisedname. And this is where it breaks.

One solution is to change the foreach:

  foreach ($components as $component => $component_localised) {

For this solution a patch is attached.

function webform_theme() {
  (...)
  // Theme functions in all components.
  $components = webform_load_components(TRUE);
  foreach ($components as $component) {  // <== value used instead of key
    $theme_hook = "_webform_theme_". $component;
    if (function_exists($theme_hook)) {
      $theme = array_merge($theme, $theme_hook());
    }
  }
  return $theme;
function webform_load_components($return_all = FALSE, $reset = FALSE) {
  static $component_list, $enabled_list;

  if (!isset($component_list) || $reset) {
    $component_list = array();
    $enabled_list = array();
    $path = drupal_get_path('module', 'webform') ."/components";
    $files = file_scan_directory($path, '^.*\.inc$');
    foreach ($files as $filename => $file) {
      $enabled = variable_get('webform_enable_'. $file->name, 1);
      if ($return_all || $enabled) {
        include_once($filename);
        $component_list[$file->name] = t($file->name);  // <== t(); makes it necessary to use the key in webform_theme()
      }
      if ($enabled) {
        $enabled_list[$file->name] = t($file->name); // t(), but not used in this case
      }
    }
  }

  // Ensure only wanted components are returned, even all are loaded.
  return $return_all ? $component_list : array_intersect_assoc($component_list, $enabled_list);
}
CommentFileSizeAuthor
webform.patch478 bytesMichaelK-1

Comments

MichaelK-1’s picture

Status: Active » Needs review

I forgot to set the right status...

quicksketch’s picture

Status: Needs review » Fixed

Thanks Michael! I also fixed the same problem calling the help text. Here's the final changes in CVS:
http://cvs.drupal.org/viewvc.py/drupal/contributions/modules/webform/web...

Committed and fixed.

Anonymous’s picture

Status: Fixed » Closed (fixed)

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