function FormTestSelectForm::makeSortableOptions
Same name in other branches
- 9 core/modules/system/tests/modules/form_test/src/Form/FormTestSelectForm.php \Drupal\form_test\Form\FormTestSelectForm::makeSortableOptions()
- 10 core/modules/system/tests/modules/form_test/src/Form/FormTestSelectForm.php \Drupal\form_test\Form\FormTestSelectForm::makeSortableOptions()
- 11.x core/modules/system/tests/modules/form_test/src/Form/FormTestSelectForm.php \Drupal\form_test\Form\FormTestSelectForm::makeSortableOptions()
Makes and returns a set of options to test sorting on.
Parameters
string $prefix: Prefix for the keys of the options.
Return value
array Options array, including option groups, for testing.
1 call to FormTestSelectForm::makeSortableOptions()
- FormTestSelectForm::buildForm in core/
modules/ system/ tests/ modules/ form_test/ src/ Form/ FormTestSelectForm.php - Form constructor.
File
-
core/
modules/ system/ tests/ modules/ form_test/ src/ Form/ FormTestSelectForm.php, line 185
Class
- FormTestSelectForm
- Builds a form to test #type 'select' validation.
Namespace
Drupal\form_test\FormCode
protected function makeSortableOptions($prefix) {
return [
// Don't use $this->t() here, to avoid adding strings to
// localize.drupal.org. Do use TranslatableMarkup in places, to test
// that labels are cast to strings before sorting.
$prefix . '_first_element' => new TranslatableMarkup('first element'),
$prefix . '_second' => new TranslatableMarkup('second element'),
$prefix . '_zzgroup' => [
$prefix . '_gc' => new TranslatableMarkup('group c'),
$prefix . '_ga' => new TranslatableMarkup('group a'),
$prefix . '_gb' => 'group b',
],
$prefix . '_yygroup' => [
$prefix . '_ge' => new TranslatableMarkup('group e'),
$prefix . '_gd' => new TranslatableMarkup('group d'),
$prefix . '_gf' => new TranslatableMarkup('group f'),
],
$prefix . '_xxgroup' => [
$prefix . '_gz' => new TranslatableMarkup('group z'),
$prefix . '_gi' => new TranslatableMarkup('group i'),
$prefix . '_gh' => new TranslatableMarkup('group h'),
],
$prefix . '_d' => 'd',
$prefix . '_c' => new TranslatableMarkup('main c'),
$prefix . '_b' => new TranslatableMarkup('main b'),
$prefix . '_a' => 'a',
];
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.