You are here

public static function DependentDropdown::getFirstDropdownOptions in Examples for Developers 3.x

Same name and namespace in other branches
  1. 8 ajax_example/src/Form/DependentDropdown.php \Drupal\ajax_example\Form\DependentDropdown::getFirstDropdownOptions()

Helper function to populate the first dropdown.

This would normally be pulling data from the database.

Return value

array Dropdown options.

1 call to DependentDropdown::getFirstDropdownOptions()
DependentDropdown::buildForm in modules/ajax_example/src/Form/DependentDropdown.php
The $nojs parameter is specified as a path parameter on the route.

File

modules/ajax_example/src/Form/DependentDropdown.php, line 203

Class

DependentDropdown
Re-populate a dropdown based on form state.

Namespace

Drupal\ajax_example\Form

Code

public static function getFirstDropdownOptions() {
  return [
    'none' => 'none',
    'String' => 'String',
    'Woodwind' => 'Woodwind',
    'Brass' => 'Brass',
    'Percussion' => 'Percussion',
  ];
}