Skip to content

Commit 71e80b1

Browse files
committed
Content and nested elements
1 parent 5bd6211 commit 71e80b1

File tree

1 file changed

+21
-3
lines changed

1 file changed

+21
-3
lines changed

docs/5.x/system/elements.md

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ related:
2121

2222
# Elements
2323

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).
2525

2626
## Element Types
2727

@@ -42,7 +42,7 @@ Choosing the appropriate element type for your content model is essential—but
4242
Some features are available to all (or most) element types:
4343

4444
- 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);
4646
- Slugs, URIs, URLs, and automatic [routing](routing.md);
4747
- Localization via [sites](sites.md);
4848
- Sophisticated [permissions](user-management.md#permissions);
@@ -53,6 +53,14 @@ Some features are available to all (or most) element types:
5353

5454
Other features are specific to a type—like Assets’ tie to files, or Entries’ nesting capability.
5555

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+
5664
## Indexes
5765

5866
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
9199
<img src="../images/element-index-view-options.png" alt="Customizing element index columns and sorting">
92100
</BrowserShot>
93101

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.
95103

96104
### Structures
97105

@@ -129,6 +137,15 @@ Both chips and cards support thumbnails, but only cards allow additional custom
129137

130138
<img src="../images/element-cards.png" alt="Two element “cards” in the Craft control panel, show thumbnails, titles, and statuses." />
131139

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+
132149
## Rendering Elements <Badge text="New!" />
133150

134151
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
246263
`enabled` | `bool` | Whether the element is enabled (globally).
247264
`id` | `int` | ID of the element.
248265
`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._
249267
`parentId` | `int|null` | ID of the parent element. _Structures only._
250268
`searchScore` | `int` | Score relative to other results when returned from an [element query](../development/element-queries.md) using the [`search` param](searching.md).
251269
`siteId` | `int` | ID of the <craft5:craft\models\Site> the element was loaded in.

0 commit comments

Comments
 (0)