function ElementInterface::createChild

Creates a render object and attaches it to the current render object.

@template T of \Drupal\Core\Render\Element\ElementInterface

Parameters

int|string $name: The name of the child. Can also be an integer.

class-string<T> $class: The class of the render object.

array $configuration: An array of configuration relevant to the render object.

bool $copyProperties: Copy properties (but not children) from the parent. This is useful for widgets for example.

Return value

T The child render object.

1 method overrides ElementInterface::createChild()
RenderElementBase::createChild in core/lib/Drupal/Core/Render/Element/RenderElementBase.php
Creates a render object and attaches it to the current render object.

File

core/lib/Drupal/Core/Render/Element/ElementInterface.php, line 139

Class

ElementInterface
Provides an interface for render element plugins.

Namespace

Drupal\Core\Render\Element

Code

public function createChild(int|string $name, string $class, array $configuration = [], bool $copyProperties = FALSE) : ElementInterface;

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