template_preprocess_form_element

function template_preprocess_form_element

template_preprocess_form_element(&$variables)

Returns HTML for a form element. Prepares variables for form element templates.

Default template: form-element.html.twig.

In addition to the element itself, the DIV contains a label for the element based on the optional #title_display property, and an optional #description.

The optional #title_display property can have these values:

  • before: The label is output before the element. This is the default. The label includes the #title and the required marker, if #required.
  • after: The label is output after the element. For example, this is used for radio and checkbox #type elements. If the #title i