modules/acm_checkout/src/Plugin/CheckoutPane/StoredAddressTrait.php
protected function getDefaultAddressOption($type, array $options) {
    $default_option = NULL;

    // Check if any address is a default for this type.
    foreach ($options as $option_id => $option) {
      $key = "default-{$type}";
      if (isset($option[$key]) && $option[$key]) {
        $default_option = $option_id;
        break;
      }
    }

    // Fallback to the first option.
    if (!$default_option || !isset($options[$default_option])) {
      $option_ids = array_keys($options);
      $default_option = reset($option_ids);
    }

    return $default_option;
  }
protected function getDefaultAddressOption($type, array $options) {
    $default_option = NULL;

    // Check if any address is a default for this type.
    foreach ($options as $option_id => $option) {
      $key = "default-{$type}";
      if (isset($option[$key]) && $option[$key]) {
        $default_option = $option_id;
        break;
      }
    }

    // Fallback to the first option.
    if (!$default_option || !isset($options[$default_option])) {
      $option_ids = array_keys($options);
      $default_option = reset($option_ids);
    }

    return $default_option;
  }
protected function getDefaultAddressOption ( $ type , array $ options ) { $ default_option = NULL ; // Check if any address is a default for this type. foreach ( $ options as $ option_id => $ option ) { $ key = "default-{$type}" ; if ( isset ( $ option [ $ key ] ) && $ option [ $ key ] ) { $ default_option = $ option_id ; break ; } } // Fallback to the first option. if ( ! $ default_option || ! isset ( $ options [ $ default_option ] ) ) { $ option_ids = array_keys ( $ options ) ; $ default_option = reset ( $ option_ids ) ; } return $ default_option ; }
Finds the default address option.

@param string $type
The address type.
@param array $options
An array of address options.

@return string
The key of the default option.
Finds the default address option .