in the select component it is possible to define options as pairs of safe_key|readable option
how do I access "some readable options" in webform-mail-x.tpl.php?
print_r($form_data) returns only safe_keys

Comments

Rafał Ch’s picture

Version: 6.x-2.0-beta1 » 5.x-2.0-beta1
Component: Documentation » Code
quicksketch’s picture

There isn't an easy way to do this. You'll have to emulate the same functionality that theme_webform_mail_select() uses.

  $rows = explode("\n", _webform_filtervalues($component['extra']['items'], NULL, NULL, FALSE));
  $options = array();

  foreach ($rows as $row) {
    $row = trim($row);
    if (preg_match('/^([^"|]+)\|(.*)$/', $row, $matches)) {
      $options[$matches[1]] = $matches[2];
    }
    else {
      $options[_webform_safe_name($row)] = $row;
    }
  }

Yikes.

quicksketch’s picture

Status: Active » Closed (fixed)