function HtmxTestForm::buildDependentOptions

1 call to HtmxTestForm::buildDependentOptions()
HtmxTestForm::buildForm in core/modules/system/tests/modules/test_htmx/src/Form/HtmxTestForm.php
Form constructor.

File

core/modules/system/tests/modules/test_htmx/src/Form/HtmxTestForm.php, line 100

Class

HtmxTestForm
A small form used to test HTMX dynamic forms.

Namespace

Drupal\test_htmx\Form

Code

protected function buildDependentOptions(string $selected) : array {
  $options = [
    'a' => [
      1 => 'One',
      2 => 'Two',
      3 => 'Three',
    ],
    'b' => [
      4 => 'Four',
      5 => 'Five',
      6 => 'Six',
    ],
  ];
  return $options[$selected] ?? [];
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.