protected function ManageDisplayTest::getAllOptionsList in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/modules/field_ui/src/Tests/ManageDisplayTest.php \Drupal\field_ui\Tests\ManageDisplayTest::getAllOptionsList()
Extracts all options from a select element.
Parameters
\SimpleXMLElement $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/ src/ Tests/ ManageDisplayTest.php - Checks if a select element contains the specified options.
File
- core/
modules/ field_ui/ src/ Tests/ ManageDisplayTest.php, line 528 - Contains \Drupal\field_ui\Tests\ManageDisplayTest.
Class
- ManageDisplayTest
- Tests the Field UI "Manage display" and "Manage form display" screens.
Namespace
Drupal\field_ui\TestsCode
protected function getAllOptionsList(\SimpleXMLElement $element) {
$options = array();
// Add all options items.
foreach ($element->option as $option) {
$options[] = (string) $option['value'];
}
// Loops trough all the option groups
foreach ($element->optgroup as $optgroup) {
$options = array_merge($this
->getAllOptionsList($optgroup), $options);
}
return $options;
}