You are here

function _webform_csv_data_name in Name Field 7

Implements Webform callback _webform_csv_format_COMPONENT().

File

includes/webform.components.inc, line 344
Name Field module name component for the Webform module.

Code

function _webform_csv_data_name($name, $export_options, $value) {
  if ($name['extra']['csv_format'] == 'separate components') {
    if (empty($value)) {
      $value = array();
    }
    $value += array(
      'title' => '',
      'given' => '',
      'middle' => '',
      'family' => '',
      'generational' => '',
      'credentials' => '',
    );
    $return = array();
    foreach (array_filter($name['extra']['enabled_components']) as $key) {
      $return[] = $value[$key];
    }
    return $return;
  }
  else {
    $themed_name = theme('name_item', array(
      'item' => $value,
      'format' => $name['extra']['table_format'],
    ));
    return $themed_name;
  }
}