function csv_to_form_api_array

7.x misc.inc csv_to_form_api_array($csv_string, $delimeter = ",", $bool_make_keys_machine_readable = TRUE)
6.x misc.inc csv_to_form_api_array($csv_string, $delimeter = ",", $bool_make_keys_machine_readable = TRUE)

Splits a basic csv but returns an array suitable for the form_api, retuns assoc array.

1 call to csv_to_form_api_array()
alerts_content_register_content_type in modules/alerts/alerts.module
For use with the content module. We will register our custom content type(s) for use with this module.

File

includes/misc.inc, line 1731
This file contains misc functions for FlightPath

Code

function csv_to_form_api_array($csv_string, $delimeter = ",", $bool_make_keys_machine_readable = TRUE) {
  $rtn = array();
  $temp = explode($delimeter, $csv_string);
  foreach ($temp as $line) {
    $line = trim($line);
    if (!$line) {
      continue;
    }

    $key = strtolower(fp_get_machine_readable($line));
    $rtn [$key] = $line;

  }

  return $rtn;

}