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 (opens new window)
# Public Properties
Property | Description |
---|---|
firstName | string (opens new window), null (opens new window) – First name |
fullName | string (opens new window), null (opens new window) – Full name |
lastName | string (opens new window), null (opens new window) – Last name |
# firstName
- Type
- string (opens new window), null (opens new window)
- Default value
null
First name
View source (opens new window)
# fullName
- Type
- string (opens new window), null (opens new window)
- Default value
null
- Since
- 4.0.0
Full name
View source (opens new window)
# lastName
- Type
- string (opens new window), null (opens new window)
- Default value
null
Last name
View source (opens new window)
# Protected Methods
Method | Description |
---|---|
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 (opens new window)
# prepareNamesForSave()
Parses fullName
if set, or sets it based on firstName
and lastName
.
← ModelInterface Plugin →