You are here

public static function ZoneTerritory::applyDefaults in Address 8

Ensures all keys are set on the provided value.

Parameters

array $value: The value.

Return value

array The modified value.

1 call to ZoneTerritory::applyDefaults()
ZoneTerritory::valueCallback in src/Element/ZoneTerritory.php
Determines how user input is mapped to an element's #value property.

File

src/Element/ZoneTerritory.php, line 73

Class

ZoneTerritory
Provides a zone territory form element.

Namespace

Drupal\address\Element

Code

public static function applyDefaults(array $value) {
  $properties = [
    'country_code',
    'administrative_area',
    'locality',
    'dependent_locality',
    'included_postal_codes',
    'excluded_postal_codes',
  ];
  foreach ($properties as $property) {
    if (!isset($value[$property])) {
      $value[$property] = NULL;
    }
  }
  return $value;
}