1 ajax_example.module _ajax_example_get_second_dropdown_options($key = '')

Helper function to populate the second dropdown.

This would normally be pulling data from the database.

Parameters

string $key: This will determine which set of options is returned.

Return value

array: The drop-down options.

Related topics

File

modules/examples/ajax_example/ajax_example.module, line 638
Hook implementations for the AJAX Example module.

Code

function _ajax_example_get_second_dropdown_options($key = '') {
  $options = array(
    t('String') => backdrop_map_assoc(
    array(
      t('Violin'),
      t('Viola'),
      t('Cello'),
      t('Double Bass'),
    )
    ),
    t('Woodwind') => backdrop_map_assoc(
    array(
      t('Flute'),
      t('Clarinet'),
      t('Oboe'),
      t('Bassoon'),
    )
    ),
    t('Brass') => backdrop_map_assoc(
    array(
      t('Trumpet'),
      t('Trombone'),
      t('French Horn'),
      t('Euphonium'),
    )
    ),
    t('Percussion') => backdrop_map_assoc(
    array(
      t('Bass Drum'),
      t('Timpani'),
      t('Snare Drum'),
      t('Tambourine'),
    )
    ),
  );
  if (isset($options[$key])) {
    return $options[$key];
  }
  else {
    return array();
  }
}