function ElementInterface::toRenderable
Returns a render array.
Parameters
string|null $wrapper_key: An optional wrapper.
Return value
array|\Drupal\Core\Render\Element\ElementInterface A render array. Make sure to take the return value as a reference. If $wrapper_key is not given then the stored render element is returned. If $wrapper_key is given then [$wrapper_key => &$element] is returned. The return value is typed with array|ElementInterface to prepare for Drupal 12, where the plan for this method is to return an ElementInterface object. If that plan goes through then in Drupal 13 support for render arrays will be dropped.
1 method overrides ElementInterface::toRenderable()
- RenderElementBase::toRenderable in core/
lib/ Drupal/ Core/ Render/ Element/ RenderElementBase.php - Returns a render array.
File
-
core/
lib/ Drupal/ Core/ Render/ Element/ ElementInterface.php, line 86
Class
- ElementInterface
- Provides an interface for render element plugins.
Namespace
Drupal\Core\Render\ElementCode
public function &toRenderable(?string $wrapper_key = NULL) : array|ElementInterface;
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.