CustomerAddressBehavior ​
- Type
- Class
- Namespace
- craft\commerce\behaviors
- Inherits
- craft\commerce\behaviors\CustomerAddressBehavior » yii\base\Behavior » yii\base\BaseObject
- Implements
- yii\base\Configurable
- Since
- 4.0.0
Customer address behavior.
Public Properties ​
Property | Description |
---|---|
isPrimaryBilling | boolean |
isPrimaryShipping | boolean |
owner | craft\elements\Address |
isPrimaryBilling
​
- Type
- boolean
- Default value
null
isPrimaryShipping
​
- Type
- boolean
- Default value
null
owner
​
- Type
- craft\elements\Address
- Default value
null
Public Methods ​
Method | Description |
---|---|
__call() | Calls the named method which is not a class method. |
__construct() | Constructor. |
__get() | Returns the value of an object property. |
__isset() | Checks if a property is set, i.e. defined and not null. |
__set() | Sets value of an object property. |
__unset() | Sets an object property to null. |
afterPropagate() | |
attach() | Attaches the behavior object to the component. |
canGetProperty() | Returns a value indicating whether a property can be read. |
canSetProperty() | Returns a value indicating whether a property can be set. |
className() | Returns the fully qualified name of this class. |
defineFields() | |
defineRules() | |
detach() | Detaches the behavior object from the component. |
events() | Declares event handlers for the owner's events. |
getIsPrimaryBilling() | Returns whether this is the user’s primary billing address. |
getIsPrimaryShipping() | Returns whether this is the user’s primary shipping address. |
hasMethod() | Returns a value indicating whether a method is defined. |
hasProperty() | Returns a value indicating whether a property is defined. |
init() | Initializes the object. |
setIsPrimaryBilling() | Sets whether this is the user’s primary billing address. |
setIsPrimaryShipping() | Sets whether this is the user’s primary shipping address. |
afterPropagate()
​
defineFields()
​
- Since
- 5.0.10
Arguments ​
$event
(craft\events\DefineFieldsEvent)
Returns ​
void
defineRules()
​
Arguments ​
$event
(craft\events\DefineRulesEvent)
Throws ​
events()
​
Declares event handlers for the owner's events.
Child classes may override this method to declare what PHP callbacks should be attached to the events of the owner component.
The callbacks will be attached to the owner's events when the behavior is attached to the owner; and they will be detached from the events when the behavior is detached from the component.
The callbacks can be any of the following:
- method in this behavior:
'handleClick'
, equivalent to[$this, 'handleClick']
- object method:
[$object, 'handleClick']
- static method:
['Page', 'handleClick']
- anonymous function:
function ($event) { ... }
The following is an example:
[
Model::EVENT_BEFORE_VALIDATE => 'myBeforeValidate',
Model::EVENT_AFTER_VALIDATE => 'myAfterValidate',
]
Returns ​
array – Events (array keys) and the corresponding event handler methods (array values).
getIsPrimaryBilling()
​
Returns whether this is the user’s primary billing address.
Returns ​
getIsPrimaryShipping()
​
Returns whether this is the user’s primary shipping address.
Returns ​
setIsPrimaryBilling()
​
Sets whether this is the user’s primary billing address.
Arguments ​
setIsPrimaryShipping()
​
Sets whether this is the user’s primary shipping address.