function Color::preRenderColor
Same name in other branches
- 9 core/lib/Drupal/Core/Render/Element/Color.php \Drupal\Core\Render\Element\Color::preRenderColor()
- 8.9.x core/lib/Drupal/Core/Render/Element/Color.php \Drupal\Core\Render\Element\Color::preRenderColor()
- 10 core/lib/Drupal/Core/Render/Element/Color.php \Drupal\Core\Render\Element\Color::preRenderColor()
Prepares a #type 'color' render element for input.html.twig.
Parameters
array $element: An associative array containing the properties of the element. Properties used: #title, #value, #description, #attributes.
Return value
array The $element with prepared variables ready for input.html.twig.
File
-
core/
lib/ Drupal/ Core/ Render/ Element/ Color.php, line 81
Class
- Color
- Provides a form element for choosing a color.
Namespace
Drupal\Core\Render\ElementCode
public static function preRenderColor($element) {
$element['#attributes']['type'] = 'color';
Element::setAttributes($element, [
'id',
'name',
'value',
]);
static::setAttributes($element, [
'form-color',
]);
return $element;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.