You are here

public static function UcPrice::preRenderPrice in Ubercart 8.4

Prepares a #type 'uc_price' render element for theme_input().

Parameters

array $element: An associative array containing the properties of the element. Properties used: #title, #value, #description, #size, #maxlength, #placeholder, #required, #attributes.

Return value

array The $element with prepared variables ready for theme_input().

File

uc_store/src/Element/UcPrice.php, line 96

Class

UcPrice
Provides a form element for Ubercart price input.

Namespace

Drupal\uc_store\Element

Code

public static function preRenderPrice(array $element) {
  $element['#attributes']['type'] = 'number';
  $element['#attributes']['step'] = 'any';
  if (empty($element['#allow_negative'])) {
    $element['#attributes']['min'] = 0;
  }
  Element::setAttributes($element, [
    'id',
    'name',
    'value',
    'size',
    'maxlength',
    'placeholder',
  ]);
  static::setAttributes($element, [
    'form-uc-price',
  ]);
  return $element;
}