You are here

public function UcAddressesAddress::setAsDefault in Ubercart Addresses 7

Same name and namespace in other branches
  1. 6.2 class/UcAddressesAddress.class.php \UcAddressesAddress::setAsDefault()

Sets this address as a default address of type $type

@access public

Parameters

string $type: The type of default to set (e.g., delivery, billing).

Return value

void

1 call to UcAddressesAddress::setAsDefault()
UcAddressesAddress::setField in class/UcAddressesAddress.class.php
Override of UcAddressesSchemaAddress::setField().

File

class/UcAddressesAddress.class.php, line 419
Contains the UcAddressesAddress class.

Class

UcAddressesAddress
The main address class used by uc_addresses (and extension modules).

Code

public function setAsDefault($type = 'billing') {
  if ($this
    ->isDefault($type)) {

    // Is already default $type, do nothing so the address doesn't
    // get unnecessary "dirty".
    return;
  }
  $this->addressBook
    ->setAddressAsDefault($this, $type);
  $this
    ->setDirty();
}