You are here

public static function MultiValue::setDefaultValue in SAML Authentication 4.x

Same name and namespace in other branches
  1. 8.3 src/Element/MultiValue.php \Drupal\samlauth\Element\MultiValue::setDefaultValue()

Sets the default value for the child elements.

Parameters

array $elements: The elements array.

array $value: An array of values, keyed by the children element name.

1 call to MultiValue::setDefaultValue()
MultiValue::processMultiValue in src/Element/MultiValue.php
Processes a multi-value form element.

File

src/Element/MultiValue.php, line 420

Class

MultiValue
Provides a multi-value form element.

Namespace

Drupal\samlauth\Element

Code

public static function setDefaultValue(array &$elements, array $value) : void {

  // @todo Handle nested elements.
  foreach (Element::children($elements, FALSE) as $child) {
    if (isset($value[$child])) {
      $elements[$child]['#default_value'] = $value[$child];
    }
  }
}