1

I've configured a webform to send a custom email after submit. One of the fields in the webform is a taxonomy select (via the Webform References module). So the value in the email template looks something like this:

[submission:values:vocabname]

When the email gets sent, the selected taxonomy term gets printed out along with a reference to its URL listed at the bottom... like this:

Term Name [1]

And then at the bottom of the email is the URL:

[1] http://www.example.com/vocab-name/term-name

How do I prevent the URL from being included automatically in the email? I just want term name alone.

1 Answer 1

1

When returning field value Webform References Module, add link to field output using theme function (theme_webform_display_term_reference_field()), which you can override in your theme's template.php and then clear Site Cache. Check sample code below, which you can write in your theme's template.php:

/**
 * Format the output of data for this component.
 */
function [THEME_NAME]_webform_display_term_reference_field($variables) {
  $values = (array) $variables['element']['#value'];
  $items = array();
  foreach (array_filter($values) as $value) {
    $tid = check_plain($value);
    if ($tid) {
      // Do not pass 2nd argument, keep it default i.e. FALSE.
      $items[] = _webform_references_get_term_name($tid);
    }
  }
  $output = count($items) > 1 ? theme('item_list', array('items' => $items)) : (isset($items[0]) ? $items[0] : '');
  return $output;
}

NOTE : This will also remove the Term field link on view submission page.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.