DrupalWebTestCase::getAllOptions

  1. drupal
    1. 8
    2. 7
Versions
7 protected DrupalWebTestCase::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.

Code

modules/simpletest/drupal_web_test_case.php, line 2340

<?php
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;
}
?>