Trait craft\base\ElementTrait
- Implemented by
- craft\base\Element, craft\elements\Asset, craft\elements\Category, craft\elements\Entry, craft\elements\GlobalSet, craft\elements\MatrixBlock, craft\elements\Tag, craft\elements\User, craft\models\BaseEntryRevisionModel, craft\models\EntryDraft, craft\models\EntryVersion
- Available since version
- 3.0
- Source Code
- https://github.com/craftcms/cms/blob/master/src/base/ElementTrait.php
ElementTrait implements the common methods and properties for element classes.
Property | Type | Description | Defined By |
---|---|---|---|
$archived |
boolean | Whether the element is archived | craft\base\ElementTrait |
$awaitingFieldValues |
boolean | Whether the element is still awaiting its custom field values | craft\base\ElementTrait |
$contentId |
integer, null | The element’s content row ID | craft\base\ElementTrait |
$dateCreated |
DateTime, null | The date that the element was created | craft\base\ElementTrait |
$dateUpdated |
DateTime, null | The date that the element was last updated | craft\base\ElementTrait |
$enabled |
boolean | Whether the element is enabled | craft\base\ElementTrait |
$enabledForSite |
boolean | Whether the element is enabled for this site. | craft\base\ElementTrait |
$fieldLayoutId |
integer, null | The element’s field layout ID | craft\base\ElementTrait |
$id |
integer, null | The element’s ID | craft\base\ElementTrait |
$level |
integer, null | The element’s level within its structure | craft\base\ElementTrait |
$lft |
integer, null | The element’s left position within its structure | craft\base\ElementTrait |
$propagating |
boolean | Whether the element is being saved in the context of propagating another site's version of the element. | craft\base\ElementTrait |
$rgt |
integer, null | The element’s right position within its structure | craft\base\ElementTrait |
$root |
integer, null | The element’s structure’s root ID | craft\base\ElementTrait |
$searchScore |
integer, null | The element’s search score, if the craft\elements\db\ElementQuery::search() parameter was used when querying for the element | craft\base\ElementTrait |
$siteId |
integer, null | The site ID the element is associated with | craft\base\ElementTrait |
$slug |
string, null | The element’s slug | craft\base\ElementTrait |
$structureId |
integer, null | The element’s structure ID | craft\base\ElementTrait |
$tempId |
string, null | The element’s temporary ID (only used if the element's URI format contains {id}) | craft\base\ElementTrait |
$title |
string, null | The element’s title | craft\base\ElementTrait |
$uid |
string, null | The element’s UID | craft\base\ElementTrait |
$uri |
string, null | The element’s URI | craft\base\ElementTrait |
Property Details
$archived
public property
#
Whether the element is archived
public boolean $archived = false
$awaitingFieldValues
public property
#
Whether the element is still awaiting its custom field values
public boolean $awaitingFieldValues = false
$contentId
public property
#
The element’s content row ID
public integer, null $contentId = null
$dateCreated
public property
#
The date that the element was created
public DateTime, null $dateCreated = null
$dateUpdated
public property
#
The date that the element was last updated
public DateTime, null $dateUpdated = null
$enabled
public property
#
Whether the element is enabled
public boolean $enabled = true
$enabledForSite
public property
#
Whether the element is enabled for this site.
public boolean $enabledForSite = true
$fieldLayoutId
public property
#
The element’s field layout ID
public integer, null $fieldLayoutId = null
$id
public property
#
The element’s ID
public integer, null $id = null
$level
public property
#
The element’s level within its structure
public integer, null $level = null
$lft
public property
#
The element’s left position within its structure
public integer, null $lft = null
$propagating
public property
#
Whether the element is being saved in the context of propagating another site's version of the element.
public boolean $propagating = false
$rgt
public property
#
The element’s right position within its structure
public integer, null $rgt = null
$root
public property
#
The element’s structure’s root ID
public integer, null $root = null
$searchScore
public property
#
The element’s search score, if the craft\elements\db\ElementQuery::search() parameter was used when querying for the element
public integer, null $searchScore = null
$siteId
public property
#
The site ID the element is associated with
public integer, null $siteId = null
$slug
public property
#
The element’s slug
public string, null $slug = null
$structureId
public property
#
The element’s structure ID
public integer, null $structureId = null
$tempId
public property
#
The element’s temporary ID (only used if the element's URI format contains {id})
public string, null $tempId = null
$title
public property
#
The element’s title
public string, null $title = null
$uid
public property
#
The element’s UID
public string, null $uid = null
$uri
public property
#
The element’s URI
public string, null $uri = null