Form and render elements - 11.x - drupal

Primary tabs

Introduction to form and render elements

Render elements are referenced in render arrays. Render arrays contain data to be rendered, along with meta-data and attributes that specify how to render the data into markup; see the Render API topic for an overview of render arrays and render elements. Form arrays are a subset of render arrays, representing HTML forms; form elements are a subset of render elements, representing HTML elements for forms. See the Form API topic for an overview of forms, form processing, and form arrays.

Each form and render element type corresponds to an element plugin class; each of them either extends \Drupal\Core\Render\Element\RenderElementBase (render elements) or \Drupal\Core\Render\Element\FormElementBase (form elements). Usage and properties are documented on the individual classes, and the two base classes list common properties shared by all render elements and the form element subset, respectively.

See also

Render API overview

Form generation




core/lib/Drupal/Core/Render/theme.api.php, line 481

Element machine name Sort descending Type Class Namespace Summary
ajax RenderElement Ajax Drupal\Core\Render\Element Provides a render element for adding Ajax to a render element.
component RenderElement ComponentElement Drupal\sdc\Element Provides a Single Directory Component render element.

Other projects

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