Skip to content

NameTrait ​

Type
Trait
Namespace
craft\base
Implemented by
craft\elements\Address, craft\elements\User
Since
4.0.0

NameTrait implements the common properties for entities with full/first/last names.

View source

Public Properties ​

PropertyDescription
firstNamestring, null – First name
fullNamestring, null – Full name
lastNamestring, null – Last name

firstName ​

Type
string, null
Default value
null

First name

View source

fullName ​

Type
string, null
Default value
null
Since
4.0.0

Full name

View source

lastName ​

Type
string, null
Default value
null

Last name

View source

Protected Methods ​

MethodDescription
normalizeNames()Normalizes the name properties.
prepareNamesForSave()Parses fullName if set, or sets it based on firstName and lastName.

normalizeNames() ​

Normalizes the name properties.

View source

prepareNamesForSave() ​

Parses fullName if set, or sets it based on firstName and lastName.

View source