You are here

function wf_crm_str2array in Webform CiviCRM Integration 7.5

Same name and namespace in other branches
  1. 7.3 webform_civicrm_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

6 calls to wf_crm_str2array()
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_admin_component::buildOptionsTable in includes/wf_crm_admin_component.inc
Interface similar to options_element module but with the important difference that options already exist in the civi db so this does not allow create/delete of options
wf_crm_admin_component::postProcess in includes/wf_crm_admin_component.inc
Custom Processing for CiviCRM webform component option lists
wf_crm_admin_component::preprocessComponentsForm in includes/wf_crm_admin_component.inc
Add CiviCRM info and theming to webform components form.
wf_crm_money_validate in includes/wf_crm_admin_component.inc
Drupal FAPI validate callback Validate money options & default value

... See full list

File

includes/utils.inc, line 1602
Webform CiviCRM module's common utility functions.

Code

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