You are here

function webform_select_options_ajax in Webform 7.3

Same name and namespace in other branches
  1. 6.3 components/select.inc \webform_select_options_ajax()
  2. 7.4 components/select.inc \webform_select_options_ajax()

Menu callback; Return a predefined list of select options as JSON.

1 string reference to 'webform_select_options_ajax'
webform_menu in ./webform.module
Implements hook_menu().

File

components/select.inc, line 745
Webform module multiple select component.

Code

function webform_select_options_ajax($source_name = '') {
  $info = _webform_select_options_info();
  $component['extra']['options_source'] = $source_name;
  if ($source_name && isset($info[$source_name])) {
    $options = _webform_select_options_to_text(_webform_select_options($component, !$component['extra']['aslist'], FALSE));
  }
  else {
    $options = '';
  }
  $return = array(
    'elementId' => module_exists('options_element') ? 'edit-items-options-options-field-widget' : 'edit-extra-items',
    'options' => $options,
  );
  drupal_json_output($return);
}