1 backdrop_web_test_case.php | protected BackdropWebTestCase::getAllOptions(SimpleXMLElement $element) |
Get all option elements, including nested options, in a select.
Parameters
$element: The element for which to get the options.
Return value
Option elements in select.:
File
- core/
modules/ simpletest/ backdrop_web_test_case.php, line 2877
Class
- BackdropWebTestCase
- Test case for typical Backdrop tests.
Code
protected function getAllOptions(SimpleXMLElement $element) {
$options = array();
// Add all options items.
foreach ($element->option as $option) {
$options[] = $option;
}
// Search option group children.
if (isset($element->optgroup)) {
foreach ($element->optgroup as $group) {
$options = array_merge($options, $this->getAllOptions($group));
}
}
return $options;
}