protected function WebTestBase::getAllOptions

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.

4 calls to WebTestBase::getAllOptions()
HandlerTest::testRelationshipUI in drupal/core/modules/views/lib/Drupal/views/Tests/Handler/HandlerTest.php
Tests the relationship ui for field/filter/argument/relationship.
WebTestBase::assertFieldByXPath in drupal/core/modules/simpletest/lib/Drupal/simpletest/WebTestBase.php
Asserts that a field exists in the current page by the given XPath.
WebTestBase::handleForm in drupal/core/modules/simpletest/lib/Drupal/simpletest/WebTestBase.php
Handle form input related to drupalPost(). Ensure that the specified fields exist and attempt to create POST data in the correct manner for the particular field type.
WizardTest::testCommentWizard in drupal/core/modules/views/lib/Drupal/views/Tests/Comment/WizardTest.php
Tests adding a view of comments.

File

drupal/core/modules/simpletest/lib/Drupal/simpletest/WebTestBase.php, line 1725
Definition of Drupal\simpletest\WebTestBase.

Class

WebTestBase
Test case for typical Drupal tests.

Namespace

Drupal\simpletest

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