You are here

public static function Color::preRenderColor in Drupal 8

Same name and namespace in other branches
  1. 9 core/lib/Drupal/Core/Render/Element/Color.php \Drupal\Core\Render\Element\Color::preRenderColor()
  2. 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\Element

Code

public static function preRenderColor($element) {
  $element['#attributes']['type'] = 'color';
  Element::setAttributes($element, [
    'id',
    'name',
    'value',
  ]);
  static::setAttributes($element, [
    'form-color',
  ]);
  return $element;
}