function public function Element::findButton

8.x-3.x Element.php public &Element::findButton()

Traverses the element to find the closest button.

Return value

\Drupal\bootstrap\Utility\Element|false The first button element or FALSE if no button could be found.

Class

Element
Provides helper methods for Drupal render elements.

Namespace

Drupal\bootstrap\Utility

Source src/Utility/Element.php (line 319)

public function &findButton() {
  $button = FALSE;
  foreach ($this->children() as $child) {
    if ($child->isButton()) {
      $button = $child;
      break;
    }
    if ($result = & $child->findButton()) {
      $button = $result;
      break;
    }
  }
  return $button;
}