You are here

function webform_civicrm_set_message in Webform CiviCRM Integration 7.2

Same name and namespace in other branches
  1. 6.2 webform_civicrm_forms.inc \webform_civicrm_set_message()
  2. 6 webform_civicrm_utils.inc \webform_civicrm_set_message()
  3. 7 webform_civicrm_utils.inc \webform_civicrm_set_message()

Displays the admin-defined message with "not you?" link to known contacts

1 call to webform_civicrm_set_message()
_webform_civicrm_webform_frontend_form_alter in ./webform_civicrm_forms.inc
Alter front-end of webforms: Called by hook_form_alter() when rendering a civicrm-enabled webform Add custom prefix. Display messages. Block users who should not have access. Set webform default values.

File

./webform_civicrm_forms.inc, line 1225

Code

function webform_civicrm_set_message($message, $contact) {
  $message = webform_civicrm_replace_tokens($message, $contact);
  preg_match_all('#\\{([^}]+)\\}#', $message, $matches);
  if (!empty($matches[0])) {
    $q = $_GET;
    unset($q['q'], $q['cs'], $q['cid'], $q['cid1']);
    if (empty($_GET['cid']) && empty($_GET['cid1'])) {
      $q['cid1'] = 0;
    }
    foreach ($matches[0] as $pos => $match) {
      $link = l($matches[1][$pos], $_GET['q'], array(
        'query' => $q,
        'alias' => TRUE,
      ));
      $message = str_replace($match, $link, $message);
    }
  }
  drupal_set_message($message);
}