public function getExistingAddressFields()
    {
        $member = Security::getCurrentUser();
        if ($member && $member->AddressBook()->exists()) {
            $addressoptions = $member->AddressBook()->sort('Created', 'DESC')->map('ID', 'toString')->toArray();
            $addressoptions['newaddress'] = _t('SilverShop\Model\Address.CreateNewAddress', 'Create new address');
            $fieldtype = count($addressoptions) > 3 ? DropdownField::class : OptionsetField::class;

            $label = _t("SilverShop\Model\Address.Existing{$this->addresstype}Address", "Existing {$this->addresstype} Address");

            return FieldList::create(
                $fieldtype::create(
                    $this->addresstype . 'AddressID',
                    $label,
                    $addressoptions,
                    $member->{'Default' . $this->addresstype . 'AddressID'}
                )->addExtraClass('existingValues')
            );
        }

        return null;
    }
public function getExistingAddressFields()
    {
        $member = Security::getCurrentUser();
        if ($member && $member->AddressBook()->exists()) {
            $addressoptions = $member->AddressBook()->sort('Created', 'DESC')->map('ID', 'toString')->toArray();
            $addressoptions['newaddress'] = _t('SilverShop\Model\Address.CreateNewAddress', 'Create new address');
            $fieldtype = count($addressoptions) > 3 ? DropdownField::class : OptionsetField::class;

            $label = _t("SilverShop\Model\Address.Existing{$this->addresstype}Address", "Existing {$this->addresstype} Address");

            return FieldList::create(
                $fieldtype::create(
                    $this->addresstype . 'AddressID',
                    $label,
                    $addressoptions,
                    $member->{'Default' . $this->addresstype . 'AddressID'}
                )->addExtraClass('existingValues')
            );
        }

        return null;
    }
public function getExistingAddressFields ( ) { $ member = Security :: getCurrentUser ( ) ; if ( $ member && $ member -> AddressBook ( ) -> exists ( ) ) { $ addressoptions = $ member -> AddressBook ( ) -> sort ( 'Created' , 'DESC' ) -> map ( 'ID' , 'toString' ) -> toArray ( ) ; $ addressoptions [ 'newaddress' ] = _t ( 'SilverShop\Model\Address.CreateNewAddress' , 'Create new address' ) ; $ fieldtype = count ( $ addressoptions ) > 3 ? DropdownField :: class : OptionsetField :: class ; $ label = _t ( "SilverShop\Model\Address.Existing{$this->addresstype}Address" , "Existing {$this->addresstype} Address" ) ; return FieldList :: create ( $ fieldtype :: create ( $ this -> addresstype . 'AddressID' , $ label , $ addressoptions , $ member -> { 'Default' . $ this -> addresstype . 'AddressID' } ) -> addExtraClass ( 'existingValues' ) ) ; } return null ; }
Allow choosing from an existing address

@return FieldList|null fields for
Allow choosing from an existing address