You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/5.x/system/elements.md
+21-3Lines changed: 21 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -21,7 +21,7 @@ related:
21
21
22
22
# Elements
23
23
24
-
An _element_ is the most basic unit of content in Craft. Elements provide smart management, routing, and querying interfaces for users and developers. Each [type](#element-types) of element has some unique capabilities, but they’re all built on top of a set of [common features](#common-features).
24
+
An _element_ is the most basic unit of [content](#content) in Craft. Elements provide smart management, routing, and querying interfaces for users and developers. Each [type](#element-types) of element has some unique capabilities, but they’re all built on top of a set of [common features](#common-features).
25
25
26
26
## Element Types
27
27
@@ -42,7 +42,7 @@ Choosing the appropriate element type for your content model is essential—but
42
42
Some features are available to all (or most) element types:
43
43
44
44
- Control panel interfaces, including forms, [indexes](#indexes), [slide-outs](control-panel.md#slideouts), and [chips and cards](#chips-cards);
45
-
-[Custom fields](fields.md) and field layouts with advanced condition rules for storing content;
45
+
-[Custom fields](fields.md) and field layouts with advanced condition rules for storing [content](#content);
46
46
- Slugs, URIs, URLs, and automatic [routing](routing.md);
@@ -53,6 +53,14 @@ Some features are available to all (or most) element types:
53
53
54
54
Other features are specific to a type—like Assets’ tie to files, or Entries’ nesting capability.
55
55
56
+
## Content
57
+
58
+
In a fresh installation, element types are distinguished only by a handful of native features. The identity and utility of an element is often defined by the [custom fields](fields.md) attached to it via a [field layout](fields.md#field-layouts): elements and their custom field values are collectively referred to as _content_.
59
+
60
+
Craft is adamantly agnostic about your content model, and comes with no predefined notion of what a “page” or “post” should be. Instead, it treats all your content as _data_, and provides the means to use it how you see fit—whether that’s as HTML accessible via public URLs, a private database, GraphQL for a decoupled or statically-generated front-end, or even a CSV to populate a printed document.
61
+
62
+
Content can be a great deal more than text, too! Craft has a number of built-in [field types](../reference/field-types/README.md) that provide a highly-customizable authoring and developer experience.
63
+
56
64
## Indexes
57
65
58
66
You’ll access most elements via their element index. Indexes allow you to browse, sort, filter, and [search](searching.md) for elements in a paginated, table-like view.
@@ -91,7 +99,7 @@ Similarly, they can customize which columns appear in the table (and how the res
91
99
<imgsrc="../images/element-index-view-options.png"alt="Customizing element index columns and sorting">
92
100
</BrowserShot>
93
101
94
-
If every field layout that would be used by an element in a source defines the same label override for a field, that label will appear in the column’s header. When a consensus cannot be reached, the original field’s label is used. This most commonly applies when a source is limited to a single entry type, asset volume, category group, or other property that also defines field layouts.
102
+
If every field layout that would be used by an element in a source defines the same label override for a field, that label will appear in the column’s header. When a consensus cannot be reached, the original field’s label is used. This most commonly applies when a source is limited to a single entry type, asset volume, category group, or other quality that also defines field layouts.
95
103
96
104
### Structures
97
105
@@ -129,6 +137,15 @@ Both chips and cards support thumbnails, but only cards allow additional custom
129
137
130
138
<imgsrc="../images/element-cards.png"alt="Two element “cards” in the Craft control panel, show thumbnails, titles, and statuses." />
131
139
140
+
## Nested Elements
141
+
142
+
Craft ships with two native _nested element_ implementations, which provide unique authoring or administrative experiences:
143
+
144
+
-[**Matrix field**](../reference/field-types/matrix.md) — Create dynamic or repeatable content sections, or manage
145
+
-[**Addresses**](../reference/element-types/addresses.md) and [**Address fields**](../reference/field-types/addresses.md) —
146
+
147
+
While [relationships](relations.md) are supported by every element type, only addresses and entries are eligible for nesting. Plugins may use the nested element interface to provide other functionality, like Commerce’s product and variant system.
148
+
132
149
## Rendering Elements <Badgetext="New!" />
133
150
134
151
Every element has a `render()` method, which you can call from a template to get an HTML representation of the object.
@@ -246,6 +263,7 @@ Property | Type | Notes
246
263
`enabled` | `bool` | Whether the element is enabled (globally).
247
264
`id` | `int` | ID of the element.
248
265
`level` | `int|null` | Depth of the element in a structure. _Structures only._
266
+
`ownerId` | `int|null` | ID of the element that “owns” this element. _[Nested elements]() only._
249
267
`parentId` | `int|null` | ID of the parent element. _Structures only._
250
268
`searchScore` | `int` | Score relative to other results when returned from an [element query](../development/element-queries.md) using the [`search` param](searching.md).
251
269
`siteId` | `int` | ID of the <craft5:craft\models\Site> the element was loaded in.
0 commit comments