modules/acm_checkout/src/Plugin/CheckoutPane/StoredAddressTrait.php
public function buildAddressOptions() {
    $address_formatter = new ACMAddressFormatter();
    $user = $this->getCurrentCommerceUser();
    $addresses = $user->getAddresses();

    // Stored addresses.
    foreach ($addresses as $address) {
      $option_id = $address['address_id'];
      $options[$option_id] = [
        'id' => $option_id,
        'label' => $address_formatter->render((object) $address),
      ];
    }

    // New address.
    $option_id = 'new_address';
    $options[$option_id] = [
      'id' => $option_id,
      'label' => $this->t('New address'),
    ];

    return $options;
  }
public function buildAddressOptions() {
    $address_formatter = new ACMAddressFormatter();
    $user = $this->getCurrentCommerceUser();
    $addresses = $user->getAddresses();

    // Stored addresses.
    foreach ($addresses as $address) {
      $option_id = $address['address_id'];
      $options[$option_id] = [
        'id' => $option_id,
        'label' => $address_formatter->render((object) $address),
      ];
    }

    // New address.
    $option_id = 'new_address';
    $options[$option_id] = [
      'id' => $option_id,
      'label' => $this->t('New address'),
    ];

    return $options;
  }
public function buildAddressOptions ( ) { $ address_formatter = new ACMAddressFormatter ( ) ; $ user = $ this -> getCurrentCommerceUser ( ) ; $ addresses = $ user -> getAddresses ( ) ; // Stored addresses. foreach ( $ addresses as $ address ) { $ option_id = $ address [ 'address_id' ] ; $ options [ $ option_id ] = [ 'id' => $ option_id , 'label' => $ address_formatter -> render ( ( object ) $ address ) , ] ; } // New address. $ option_id = 'new_address' ; $ options [ $ option_id ] = [ 'id' => $ option_id , 'label' => $ this -> t ( 'New address' ) , ] ; return $ options ; }
Builds the address options list.

@return array
An array of address options.
Builds the address options list .