template_preprocess_form(&$variables)
Prepares variables for form templates.
Default template: form.html.twig.
$variables: An associative array containing:
function template_preprocess_form(&$variables) { $element = $variables['element']; if (isset($element['#action'])) { $element['#attributes']['action'] = UrlHelper::stripDangerousProtocols($element['#action']); } Element::setAttributes($element, array('method', 'id')); if (empty($element['#attributes']['accept-charset'])) { $element['#attributes']['accept-charset'] = "UTF-8"; } $variables['attributes'] = $element['#attributes']; $variables['children'] = $element['#children']; }
© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!includes!form.inc/function/template_preprocess_form/8.1.x