You are here

function _webform_grid_options in Webform 6.2

Same name and namespace in other branches
  1. 5.2 components/grid.inc \_webform_grid_options()

Utility function to split user-entered values from new-line separated text into an array of options.

7 calls to _webform_grid_options()
theme_webform_mail_grid in components/grid.inc
Format the output of emailed data for this component.
_webform_analysis_rows_grid in components/grid.inc
Calculate and returns statistics about results for this component from all submission to this webform. The output of this function will be displayed under the "results" tab then "analysis".
_webform_csv_data_grid in components/grid.inc
Return the result of a textfield submission. The output of this function will be displayed under the "results" tab then "submissions".
_webform_csv_headers_grid in components/grid.inc
Return the header information for this component to be displayed in a comma seperated value file. The output of this function will be displayed under the "results" tab then "download".
_webform_render_grid in components/grid.inc

... See full list

File

components/grid.inc, line 410
Webform module grid component.

Code

function _webform_grid_options($text) {
  $options = array();
  $rows = array_filter(explode("\n", _webform_filter_values(trim($text))));
  foreach ($rows as $option) {
    $option = trim($option);
    if (preg_match('/^([^|]+)\\|(.*)$/', $option, $matches)) {
      $options[$matches[1]] = $matches[2];
    }
    else {
      $options[$option] = $option;
    }
  }
  return $options;
}