You are here

public static function WebformElementHelper::hasChildren in Webform 6.x

Same name and namespace in other branches
  1. 8.5 src/Utility/WebformElementHelper.php \Drupal\webform\Utility\WebformElementHelper::hasChildren()

Determine if an element has children.

Parameters

array|mixed $element: An element.

Return value

bool TRUE if an element has children.

See also

\Drupal\Core\Render\Element::children

1 call to WebformElementHelper::hasChildren()
WebformHandlerBase::setSettingsParentsRecursively in src/Plugin/WebformHandlerBase.php
Set configuration settings parents.

File

src/Utility/WebformElementHelper.php, line 128

Class

WebformElementHelper
Helper class webform element methods.

Namespace

Drupal\webform\Utility

Code

public static function hasChildren($element) {
  foreach ($element as $key => $value) {
    if ($key === '' || $key[0] !== '#') {
      return TRUE;
    }
  }
  return FALSE;
}