protected function ManageDisplayTest::getAllOptionsList in Drupal 8
Same name and namespace in other branches
- 9 core/modules/field_ui/tests/src/Functional/ManageDisplayTest.php \Drupal\Tests\field_ui\Functional\ManageDisplayTest::getAllOptionsList()
Extracts all options from a select element.
Parameters
Behat\Mink\Element\NodeElement $element: The select element field information.
Return value
array An array of option values as strings.
1 call to ManageDisplayTest::getAllOptionsList()
- ManageDisplayTest::assertFieldSelectOptions in core/
modules/ field_ui/ tests/ src/ Functional/ ManageDisplayTest.php - Checks if a select element contains the specified options.
File
- core/
modules/ field_ui/ tests/ src/ Functional/ ManageDisplayTest.php, line 321
Class
- ManageDisplayTest
- Tests the Field UI "Manage display" and "Manage form display" screens.
Namespace
Drupal\Tests\field_ui\FunctionalCode
protected function getAllOptionsList(NodeElement $element) {
$options = [];
// Add all options items.
foreach ($element->option as $option) {
$options[] = $option
->getValue();
}
// Loops trough all the option groups
foreach ($element->optgroup as $optgroup) {
$options = array_merge($this
->getAllOptionsList($optgroup), $options);
}
return $options;
}