public static function Color::preRenderColor

public static Color::preRenderColor($element)

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, array('id', 'name', 'value'));
  static::setAttributes($element, array('form-color'));

  return $element;
}

© 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!lib!Drupal!Core!Render!Element!Color.php/function/Color::preRenderColor/8.1.x