function ElementInterface::setAttributes
Same name in other branches
- 8.9.x core/lib/Drupal/Core/Render/Element/ElementInterface.php \Drupal\Core\Render\Element\ElementInterface::setAttributes()
- 10 core/lib/Drupal/Core/Render/Element/ElementInterface.php \Drupal\Core\Render\Element\ElementInterface::setAttributes()
- 11.x core/lib/Drupal/Core/Render/Element/ElementInterface.php \Drupal\Core\Render\Element\ElementInterface::setAttributes()
Sets a form element's class attribute.
Adds 'required' and 'error' classes as needed.
Parameters
array $element: The form element.
array $class: Array of new class names to be added.
1 method overrides ElementInterface::setAttributes()
- RenderElement::setAttributes in core/
lib/ Drupal/ Core/ Render/ Element/ RenderElement.php - Sets a form element's class attribute.
File
-
core/
lib/ Drupal/ Core/ Render/ Element/ ElementInterface.php, line 53
Class
- ElementInterface
- Provides an interface for render element plugins.
Namespace
Drupal\Core\Render\ElementCode
public static function setAttributes(&$element, $class = []);
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.