function RenderElementBase::getChild

Gets a child.

Parameters

int|string|list<int|string> $name: The name of the child. Can also be an integer. Or a list of these. It is an integer when the field API uses the delta for children.

Return value

?\Drupal\Core\Render\Element\ElementInterface The child render object.

Overrides ElementInterface::getChild

File

core/lib/Drupal/Core/Render/Element/RenderElementBase.php, line 656

Class

RenderElementBase
Provides a base class for render element plugins.

Namespace

Drupal\Core\Render\Element

Code

public function getChild(int|string|array $name) : ?ElementInterface {
  $value =& NestedArray::getValue($this->storage, (array) $name, $exists);
  return $exists ? $this->elementInfoManager()
    ->fromRenderable($value) : NULL;
}

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