You are here

public static function Price::validateDefaultValue in Commerce Core 8.2

Validates the default value.

Parameters

mixed $default_value: The default value.

Return value

bool TRUE if the default value is valid, FALSE otherwise.

1 call to Price::validateDefaultValue()
Price::processElement in modules/price/src/Element/Price.php
Builds the commerce_price form element.

File

modules/price/src/Element/Price.php, line 173

Class

Price
Provides a price form element.

Namespace

Drupal\commerce_price\Element

Code

public static function validateDefaultValue($default_value) {
  if (!is_array($default_value)) {
    return FALSE;
  }
  if (!array_key_exists('number', $default_value) || !array_key_exists('currency_code', $default_value)) {
    return FALSE;
  }
  return TRUE;
}