You are here

public static function DependentDropdown::getFirstDropdownOptions in Examples for Developers 8

Same name and namespace in other branches
  1. 3.x modules/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 ajax_example/src/Form/DependentDropdown.php
The $nojs parameter is specified as a path parameter on the route.

File

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',
  ];
}