You are here

public static function UcQuantity::preRenderQuantity in Ubercart 8.4

Prepares a #type 'uc_quantity' 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, #min, #max, #step, #required, #attributes.

Return value

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

File

uc_store/src/Element/UcQuantity.php, line 64

Class

UcQuantity
Provides a form element for Ubercart quantity input.

Namespace

Drupal\uc_store\Element

Code

public static function preRenderQuantity(array $element) {
  $element['#attributes']['type'] = 'number';
  $element['#attributes']['min'] = 0;
  $element['#attributes']['step'] = 1;
  Element::setAttributes($element, [
    'id',
    'name',
    'value',
    'size',
    'maxlength',
    'placeholder',
    'min',
    'max',
    'step',
  ]);
  static::setAttributes($element, [
    'form-uc-quantity',
  ]);
  return $element;
}