function Element::child

Same name in other branches
  1. 9 core/lib/Drupal/Core/Render/Element.php \Drupal\Core\Render\Element::child()
  2. 8.9.x core/lib/Drupal/Core/Render/Element.php \Drupal\Core\Render\Element::child()
  3. 11.x core/lib/Drupal/Core/Render/Element.php \Drupal\Core\Render\Element::child()

Checks if the key is a child.

Parameters

string $key: The key to check.

Return value

bool TRUE if the element is a child, FALSE otherwise.

2 calls to Element::child()
ElementTest::testChild in core/tests/Drupal/Tests/Core/Render/ElementTest.php
Tests the child() method.
template_preprocess_language_negotiation_configure_form in core/modules/language/language.admin.inc
Prepares variables for language negotiation configuration form.

File

core/lib/Drupal/Core/Render/Element.php, line 51

Class

Element
Provides helper methods for Drupal render elements.

Namespace

Drupal\Core\Render

Code

public static function child($key) {
    return !isset($key[0]) || $key[0] != '#';
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.