You are here

function wf_crm_str2array in Webform CiviCRM Integration 7.3

Same name and namespace in other branches
  1. 7.5 includes/utils.inc \wf_crm_str2array()
  2. 7.4 includes/utils.inc \wf_crm_str2array()

Convert a | separated string into an array

Parameters

string $str: String representation of key => value select options

Return value

array of select options

5 calls to wf_crm_str2array()
theme_webform_civicrm_components_form in ./webform_civicrm_admin.inc
Theme override for webform components form.
webform_civicrm_update_7300 in ./webform_civicrm.install
Note: There are differences in how contact references and relationships work in the 3.x branch. Read the upgrade instructions at http://drupal.org/node/1615380
wf_crm_exposed_options in ./webform_civicrm_forms.inc
For a given field, find the options that are exposed to the webform.
wf_crm_process_options_selection in ./webform_civicrm_admin.inc
Drupal FAPI form submit callback Custom Processing for CiviCRM webform component option lists
_wf_crm_component_form_alter in ./webform_civicrm_admin.inc
Alter back-end webform component edit forms. Called by hook_form_alter() whenever editing a webform component.

File

./webform_civicrm_utils.inc, line 1220
Webform CiviCRM module's common utility functions.

Code

function wf_crm_str2array($str) {
  $ret = array();
  if ($str) {
    foreach (explode("\n", trim($str)) as $row) {
      list($k, $v) = explode('|', $row);
      $ret[trim($k)] = trim($v);
    }
  }
  return $ret;
}