You are here

function _webform_csv_headers_name in Name Field 7

Implements Webform callback _webform_csv_headers_COMPONENT().

File

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

Code

function _webform_csv_headers_name($name, $export_options) {
  $header = array();
  if ($name['extra']['csv_format'] == 'separate components') {
    $components = array_filter($name['extra']['enabled_components']);
    $header[0] = $header[1] = array_fill(0, count($components), '');
    $header[1][0] = $name['name'];

    // Preserve ordering.
    $header[2] = array();
    $nt = _name_translations();
    foreach ($components as $key) {
      $header[2][] = $nt[$key];
    }
  }
  else {
    $header[0] = '';
    $header[1] = '';
    $header[2] = $name['name'];
  }
  return $header;
}