, use `entry.type.original`.
+
+This can help improve the legibility of templates, wherein the generic `announcement` handle doesn’t describe how the entry type is actually used:
+
+```twig{2,8-11}
+{% for contentBlock in entry.myMatrixField %}
+
+ {% switch contentBlock.type.handle %}
+ {% case 'carousel'}
+ {# ... #}
+ {% case 'recommended'}
+ {# ... #}
+ {% case 'banner' %}
+ {# Perhaps “Banner” made more sense than “Announcement” in this context, when designing! #}
+
{{ contentBlock.title }}
+ {{ contentBlock.message|md }}
+ {% default %}
+ {{ contentBlock.render() }}
+ {% endswitch %}
+
+{% endfor %}
+```
+
### Dynamic Entry Titles
The **Default Title Format** field accepts an [object template](../../system/object-templates.md) (just like the **Entry URI Format** and preview target **URL Format** we looked, above), and is evaluated whenever entries with this type are saved _without an explicitly-set title_. A title format may be rendered multiple times, depending on the selected **Title Translation Method**.
@@ -67,7 +120,7 @@ The available translation methods are covered in the [custom fields documentatio
## Sections
-Sections organize and expose entry types for content authors. In each section you can define the following:
+Sections organize and expose [entry types](#entry-types) for content authors. In each section you can define the following:
- Whether entries in the section have URLs;
- What the entries’ URLs should look like;
@@ -80,7 +133,7 @@ If your project has multiple [sites](../../system/sites.md), your section can de
- Which sites entries in the section should target;
- Which sites entries are created in, by default;
-To create a new section, go to **Settings** → **Sections** and choose **New Section**.
+To create a new section, go to and choose **New Section**.
### Section Types
@@ -88,7 +141,7 @@ Craft has three different types of sections:
#### Singles
-
+
Singles are used for one-off pages or content objects that have unique requirements, such as…
@@ -106,7 +159,7 @@ A single’s **Status** controls can be hidden with the **Show the Status field*
#### Channels
-
+
Channels are used for lists or streams of similar content, such as…
@@ -121,11 +174,11 @@ Entries in channels are intended to be queried and displayed ordered by one or m
Structures are an extension of channels that support explicit, hierarchical organization.
-
+
Unlike other section types, structure sections expose a **Structure** view option on their [element indexes](../../system/elements.md#indexes):
-
+
Types of content that might benefit from being defined as a structure include…
@@ -166,7 +219,7 @@ When Craft matches a request to an entry, its section’s designated **Template*
Consider these tips for creating special URIs:
-- A URI that evaluates to `__home__` (and nothing more) will be available at your site’s base path;
+- A URI that evaluates to `__home__` (and nothing more) will be available at your site’s base path (this should only be used for [singles](#singles));
- An empty URI means the entry does not get a route and will not have a public URL—unless you define one manually via `routes.php`;
- Any Twig statement can be used to output values in a URI template—including ones that query for other elements, e.g. `{{ craft.entries().section('mySingle').one().slug }}/news` (see note below);
- [Aliases](../../configure.md#aliases-and-environment-variables) can be evaluated with the [`alias()` function](../twig/functions.md#alias): `{{ alias('@basePressUri') }}/news`, `{{ alias('@mySectionUri') }}`.
diff --git a/docs/5.x/reference/element-types/users.md b/docs/5.x/reference/element-types/users.md
index 7e1c5a7a8..592140651 100644
--- a/docs/5.x/reference/element-types/users.md
+++ b/docs/5.x/reference/element-types/users.md
@@ -92,6 +92,18 @@ By {{ collect(entry.authors).pluck('fullName').join(', ', ', and ') }}
Unlike most other element types, users do _not_ have a “URI format” setting or support slugs, and are not factored into routing.
+### Affiliated Site
+
+[Multi-site](../../system/sites.md) projects capture the site a user [registers](../../system/user-management.md#affiliated-site) from (or is assigned to by an admin). Add the **Affiliated Site** [field layout element](#custom-fields) to manage this in the control panel.
+
+A user’s affiliated site can be accessed in a template via `user.affiliatedSite`:
+
+```twig
+{% if currentUser.affiliatedSite %}
+ You registered via {{ currentUser.affiliatedSite.name }}.
+{% endif %}
+```
+
## Querying Users
You can fetch users in your templates or PHP code using **user queries**.
diff --git a/docs/5.x/reference/field-types/color.md b/docs/5.x/reference/field-types/color.md
index b24a8332f..44a183f4c 100644
--- a/docs/5.x/reference/field-types/color.md
+++ b/docs/5.x/reference/field-types/color.md
@@ -1,73 +1,102 @@
# Color Fields
-Color fields give you a hexadecimal color input with a preview of the current color, and on browsers that support ` `, clicking on the preview will open the browser’s color picker.
+Color fields provide a flexible way to store hexadecimal color values. You can define a [palette](#palette) to guide authors , or use an [open-ended input](#custom-colors).
+
+
+## Settings
+
+
+
+
+
+### Palette
+
+Each field contains a **Palette** of colors that authors can select from a dropdown menu.
+
+### Custom Colors
+
+Turn on **Allow custom colors** to display a compact input and color preview UI. When used in conjunction with a palette, an additional **Custom…** option is listed at the bottom of the dropdown menu.
+
+::: tip
+In [browsers that support ` `](https://caniuse.com/input-color), clicking on the color preview “well” opens a native OS color picker.
+:::
+
## Development
-Calling a Color field in your templates will return a object, or `null` if no color was selected.
+Accessing a color field returns a object, or `null` if no color was selected.
-By default, the bare field handle will return a hexadecimal representation of that color:
+Casting a `ColorData` object to a string by outputting it directly produces a hexadecimal representation of the color:
::: code
```twig
-{% if entry.myFieldHandle %}
+{% if entry.myColorField %}
{% endif %}
```
```php
-if ($entry->myFieldHandle) {
- echo $entry->myFieldHandle;
- // same thing
- echo $entry->myFieldHandle->getHex();
+if ($entry->myColorField) {
+ echo $entry->myColorField;
+ // …is equivalent to…
+ echo $entry->myColorField->getHex();
}
```
:::
-Here’s an impractical example illustrating each method:
+`ColorData` objects have a number of methods that streamline working with color values:
::: code
```twig
-{% if entry.myFieldHandle %}
- {{ entry.myFieldHandle }} {# output: #e5422b #}
- {{ entry.myFieldHandle.getHex() }} {# output: #e5422b #}
- {{ entry.myFieldHandle.getRgb() }} {# output: rgb(229,66,43) #}
- {{ entry.myFieldHandle.getHsl() }} {# output: hsl(7,81%,90%) #}
- {{ entry.myFieldHandle.getLuma() }} {# output: 0.38820862745098 #}
- {{ entry.myFieldHandle.getHue() }} {# output: 7 #}
- {{ entry.myFieldHandle.getLightness() }} {# output: 90 #}
- {{ entry.myFieldHandle.getSaturation() }} {# output: 81 #}
- {{ entry.myFieldHandle.getRed() }} {# output: 229 #}
- {{ entry.myFieldHandle.getGreen() }} {# output: 66 #}
- {{ entry.myFieldHandle.getBlue() }} {# output: 43 #}
+{% if entry.myColorField %}
+ {{ entry.myColorField }} {# output: #e5422b #}
+ {{ entry.myColorField.getHex() }} {# output: #e5422b #}
+ {{ entry.myColorField.getRgb() }} {# output: rgb(229,66,43) #}
+ {{ entry.myColorField.getHsl() }} {# output: hsl(7,81%,90%) #}
+ {{ entry.myColorField.getLuma() }} {# output: 0.38820862745098 #}
+ {{ entry.myColorField.getHue() }} {# output: 7 #}
+ {{ entry.myColorField.getLightness() }} {# output: 90 #}
+ {{ entry.myColorField.getSaturation() }} {# output: 81 #}
+ {{ entry.myColorField.getRed() }} {# output: 229 #}
+ {{ entry.myColorField.getGreen() }} {# output: 66 #}
+ {{ entry.myColorField.getBlue() }} {# output: 43 #}
{% endif %}
```
```php
-if ($entry->myFieldHandle) {
- echo $entry->myFieldHandle; // output: #e5422b
- echo $entry->myFieldHandle->getHex(); // output: #e5422b
- echo $entry->myFieldHandle->getRgb(); // output: rgb(229,66,43)
- echo $entry->myFieldHandle->getHsl(); // output: hsl(7,81%,90%)
- echo $entry->myFieldHandle->getLuma(); // output: 0.38820862745098
- echo $entry->myFieldHandle->getHue(); // output: 7
- echo $entry->myFieldHandle->getLightness(); // output: 90
- echo $entry->myFieldHandle->getSaturation(); // output: 81
- echo $entry->myFieldHandle->getRed(); // output: 229
- echo $entry->myFieldHandle->getGreen(); // output: 66
- echo $entry->myFieldHandle->getBlue(); // output: 43
+if ($entry->myColorField) {
+ echo $entry->myColorField; // output: #e5422b
+ echo $entry->myColorField->getHex(); // output: #e5422b
+ echo $entry->myColorField->getRgb(); // output: rgb(229,66,43)
+ echo $entry->myColorField->getHsl(); // output: hsl(7,81%,90%)
+ echo $entry->myColorField->getLuma(); // output: 0.38820862745098
+ echo $entry->myColorField->getHue(); // output: 7
+ echo $entry->myColorField->getLightness(); // output: 90
+ echo $entry->myColorField->getSaturation(); // output: 81
+ echo $entry->myColorField->getRed(); // output: 229
+ echo $entry->myColorField->getGreen(); // output: 66
+ echo $entry->myColorField->getBlue(); // output: 43
}
```
:::
::: tip
-The example omits the `getL()`, `getS()`, `getR()`, `getG()`, and `getB()` methods, which are abbreviated forms of `getLuma()`, `getSaturation()`, `getRed()`, `getGreen()`, and `getBlue()` respectively.
+Refer to the [`ColorData`](craft5:craft\fields\data\ColorData) class reference for a complete list of methods!
:::
+
+## Querying by Color
+
+There are no special query features for color fields; refer to the [plain text](plain-text.md) field for a list of standard string comparison syntaxes.
diff --git a/docs/5.x/reference/field-types/email.md b/docs/5.x/reference/field-types/email.md
index 31f5654ba..c68ee61ba 100644
--- a/docs/5.x/reference/field-types/email.md
+++ b/docs/5.x/reference/field-types/email.md
@@ -10,6 +10,10 @@ Email fields give you a normal text input that requires a valid email address.
+::: tip
+The new [Link field](link.md) also supports email addresses.
+:::
+
## Settings
Email fields have the following settings:
diff --git a/docs/5.x/reference/field-types/link.md b/docs/5.x/reference/field-types/link.md
index 691760dc2..65d4bf4c6 100644
--- a/docs/5.x/reference/field-types/link.md
+++ b/docs/5.x/reference/field-types/link.md
@@ -50,15 +50,26 @@ In addition to the standard field options, Link fields have the following settin
:::
- **Show the “Label” field** — Displays a dedicated field to override the default/generated link label.
-- **Show the “Open in a new tab” field** — Whether or not authors can choose to have links open in a new tab.
-- **Max Length** — The maximum number of characters the field can contain. (Defaults to `255`.)
+- **Advanced Fields** — Expose a variety of options to editors for controlling specific anchor tag attributes in the resulting HTML.
+ - **Target** — Shows an **Open in a new tab?** lightswitch. (In earlier versions of Craft, this was a discrete setting labeled **Show the “Open in a new tab” field**.)
+ - **URL Suffix** — Shows a field for an arbitrary URI fragment that will be appended to the resolved URL.
+ - **Title Text** — Content for the anchor’s `title` attribute.
+ - **Class Name** — Content for the anchor’s `class` attribute.
+ - **ID** — Content for the anchor’s `id` attribute.
+ - **Relation (rel)** — Content for the anchor’s `rel` attribute.
+ - **ARIA Label ** — Content for the anchor’s `aria-label` attribute.
+
+### Advanced Options
+
+- **Max Length** — The maximum number of characters the primary field value can contain. (Defaults to `255`.)
+- **GraphQL Mode** — For backwards-compatibility with the URL field type, Craft returns the fully-rendered link as a string when requested via GraphQL; switch this to **Full data** to make individual nested properties available. View the `LinkData` type in the [GraphiQL explorer](../../development/graphql.md#using-the-graphiql-ide) for a complete list of supported sub-properties. The full URL (equivalent to the field’s behavior in **URL only** mode) is under the `url` field.
### Type-Specific Options
-When the _URL link type is enabled, two more options become available:
+When the **URL** link type is enabled, two more options become available:
- **Allow root-relative URLs** — Accepts an absolute path, without a protocol or hostname (i.e. `/give`). Relative paths are still not allowed (i.e. `donate`), as they are ambiguous in most contexts.
-- **Allow anchors** — Accepts values that contain only a fragment or hash-prefixed anchor, like `#my-heading`.
+- **Allow anchors** — Accepts values that contain only a fragment or hash-prefixed anchor, like `#my-heading`. This should not be enabled alongside the **URL Suffix** advanced field.
When enabling a link type that references elements, Craft will display a set of checkboxes that allow you to limit selection to specific [sources](../../system/elements.md#sources)—and in the case of assets, the allowable file kinds.
diff --git a/docs/5.x/reference/field-types/matrix.md b/docs/5.x/reference/field-types/matrix.md
index 8a9532a6f..080cb4dea 100644
--- a/docs/5.x/reference/field-types/matrix.md
+++ b/docs/5.x/reference/field-types/matrix.md
@@ -24,6 +24,12 @@ Matrix fields have the following settings:
Select from existing, globally-defined [entry types](../element-types/entries.md#entry-types), or create a new one on-the-fly.
+::: tip
+You can specify local overrides for each of the attached entry types’ **Name** and **Handle** by selecting **Settings** from a chip’s action menu. A pencil icon will be displayed in any entry type chip that has overrides.
+
+
+:::
+
#### Propagation Method
Choose how nested entries are propagated to other sites. This applies only to _new_ nested entries—changes to _existing_ nested entries are propagated on a per-field basis.
diff --git a/docs/5.x/reference/field-types/plain-text.md b/docs/5.x/reference/field-types/plain-text.md
index f8744c020..4084d0ad9 100644
--- a/docs/5.x/reference/field-types/plain-text.md
+++ b/docs/5.x/reference/field-types/plain-text.md
@@ -1,12 +1,12 @@
# Plain Text Fields
-**Plain Text** fields give you either a normal text `input` or a multi-line `textarea`, where plain text can be entered. How that text is used is entirely up to you!
+**Plain text** fields give you either a normal text `input` or a multi-line `textarea`, where plain text can be entered. How that text is used is entirely up to you!
## Settings
-Plain Text fields have the following settings:
+Plain text fields have the following settings:
- **UI Mode** — How the field should be presented in the control panel. (Defaults to “Normal”, can be “Enlarged”.)
- **Placeholder Text** — The field’s placeholder text, to be displayed if the field has no value yet.
@@ -17,11 +17,11 @@ Plain Text fields have the following settings:
## The Field
-Plain Text fields will either show a normal text `input` element or a multi-line `textarea`, depending on whether **Allow line breaks** was checked. To give editors more space, increase the number of **Initial Rows**.
+Plain text fields will either show a normal text `input` element or a multi-line `textarea`, depending on whether **Allow line breaks** was checked. To give editors more space, increase the number of **Initial Rows**.
## Development
-Accessing a Plain Text field in your templates will return the value that was entered in the field. Suppose our field was named “Summary” and had a handle of `summary`:
+Accessing a plain text field in your templates will return the value that was entered in the field. Suppose our field was named “Summary” and had a handle of `summary`:
```twig
{{ entry.summary }}
@@ -84,3 +84,97 @@ I can’t live without {globalset:snippets:primaryProductName}!
I can’t live without Butter™!
```
:::
+
+### Querying
+
+Plain text field values are stored as strings, and therefore support a variety of convenient query features via .
+
+#### Exact Matches
+
+Open-ended inputs aren’t ideal for storing enum-style data (leave that to a [dropdown field](dropdown.md)), but you can still query based on the exact text content of a field:
+
+```twig{3}
+{% set reds = craft.entries()
+ .section('swatches')
+ .colorGroupCode('RED')
+ .all() %}
+```
+
+#### Multiple Values
+
+Match against a list using comma-separated values or an array:
+
+```twig
+{# Separate values with commas... #}
+{% set sunrisePalette = craft.entries()
+ .section('swatches')
+ .colorGroupCode('PINK, RED, YELLOW, ORANGE')
+ .all() %}
+
+{# ...or use an array: #}
+{% set sunrisePalette = craft.entries()
+ .section('swatches')
+ .colorGroupCode(['PINK', 'RED', 'YELLOW', 'ORANGE'])
+ .all() %}
+```
+
+These examples are ultimately assembled into a `NOT IN (...)` SQL clause.
+
+#### Negation
+
+Exclude elements with a specific field value by preceding a value with `not`:
+
+```twig
+{% set notCool = craft.entries()
+ .section('swatches')
+ .colorGroupCode('not BLUE')
+ .all() %}
+```
+
+Multiple values can be excluded by preceding each term in a comma-separated list by a `not` (`'not BLUE, not GREEN'`), or by using `not` as the first item in an array (`['not', 'BLUE', 'GREEN']).
+
+::: warning
+The grouping of terms is important when combining ranges and negation! `not RED, YELLOW` means “Swatches with a color other than `RED`, _or_ swatches with a color of `YELLOW`.” On the other hand, `['not', 'RED', 'YELLOW']` means “Swatches with a color other than `RED` or `YELLOW`.” The former would exclude “red” swatches, but allow “yellow;” the latter would exclude both colors.
+:::
+
+#### Partial Matches
+
+You can query using partial matches by including an asterisk (`*`) at the beginning and/or end of a value:
+
+```twig
+{# All “pastel” families: #}
+{% set pastels = craft.entries()
+ .section('swatches')
+ .colorGroupCode('PASTEL-*')
+ .all() %}
+
+{# All “glossy” group variations: #}
+{% set glosses = craft.entries()
+ .section('swatches')
+ .colorGroupCode('*-GLOSS')
+ .all() %}
+```
+
+Combined with the above, a param like `'not *-MATTE'` is also valid. Queries that use asterisks are generally compiled into `LIKE` statements compatible with the database driver.
+
+#### Empty Values
+
+The special tokens `:empty:` and `:notempty:` can be used to find elements with a plain text field that is empty or populated, respectively. Both tokens are compiled into query conditions that compare against `null` _and_ empty string (`''`) values.
+
+#### Literal Symbols
+
+To use asterisks or commas in a query param, pass your value through the [`literal` Twig filter](../twig/filters.md#literal).
+
+#### Case-Sensitivity
+
+[Query values are case-sensitive](../../development/element-queries.md#case-sensitivity), by default. To make a query case-_insensitive_, use a hash with `value` and `caseInsensitive` keys:
+
+```twig{3-6}
+{% set reds = craft.entries()
+ .section('swatches')
+ .colorGroupCode({
+ value: 'red',
+ caseInsensitive: true,
+ })
+ .all() %}
+```
diff --git a/docs/5.x/reference/twig/global-variables.md b/docs/5.x/reference/twig/global-variables.md
index 5201290a4..3857cb492 100644
--- a/docs/5.x/reference/twig/global-variables.md
+++ b/docs/5.x/reference/twig/global-variables.md
@@ -43,6 +43,7 @@ Variable | Description
[loginUrl](#loginurl) | The URL to the front-end Login page.
[logoutUrl](#logouturl) | The URL to the front-end Logout page.
[now](#now) | The current date/time.
+[primarySite](#primarysite) | In multi-site projects, the “primary” site.
[setPasswordUrl](#setpasswordurl) | The URL to the front-end [Reset Password](kb:front-end-user-accounts#reset-password-forms) page.
[siteName](#sitename) | The name of the current site.
[siteUrl](#siteurl) | The base URL of the current site.
@@ -216,6 +217,23 @@ A [DateTime](http://php.net/manual/en/class.datetime.php) object set to the curr
Today is {{ now|date('M j, Y') }}.
```
+### `primarySite`
+
+The _primary_ site (as designated in ), as an instance of .
+
+```twig
+{# Output the primary site’s name: #}
+We are a proud member of {{ primarySite.name }}
+
+{# Link to a page on the primary site: #}
+{{ tag('a', {
+ href: siteUrl('about/governance', siteId = primarySite.id),
+ text: 'Learn about our family of businesses',
+}) }}
+```
+
+`primarySite` will be a reference to the same object as [`currentSite`](#currentsite), when `currentSite.primary` is `true`. You can also retrieve the primary site via `craft.app.sites.primarySite`.
+
### `setPasswordUrl`
The URL to [`setPasswordRequestPath`](config5:setPasswordRequestPath) if it’s set. (This wraps the path in [`siteUrl`](#siteurl).)
diff --git a/docs/5.x/system/control-panel.md b/docs/5.x/system/control-panel.md
index 43f98e0c0..074ef4bb7 100644
--- a/docs/5.x/system/control-panel.md
+++ b/docs/5.x/system/control-panel.md
@@ -131,9 +131,9 @@ You can disable a utility for all users with the [`disabledUtilities` config set
The **Settings** screen is where you’ll configure the system and design your content model. Settings complement [configuration](../configure.md) are typically stored in [Project Config](project-config.md) so that you can easily deploy them to other environments.
::: tip
-Don’t see **Settings** in the main navigation? Make sure you have admin privileges, and that is enabled.
+Don’t see **Settings** in the main navigation? Make sure you have admin privileges, and that is enabled. In Craft 5.6 and later, administrators always have access to settings in [read-only mode](#read-only-mode).
-We recommend that this is enabled only in development environments.
+We recommend that this is enabled [only in development environments](../deploy.md#admin-changes).
:::
screen.
+#### Read-Only Mode
+
+[Administrators](user-management.md#admin-accounts) can always _view_ settings. A banner appears at the top of each settings screen, and inputs and controls are simplified or disabled:
+
+
+
+
+
### Plugin Store
-The control panel provides an easy way to browse the [Plugin Store](plugins.md#the-plugin-store) and try or buy plugins with one click.
+The control panel provides an easy way to browse the [Plugin Store](plugins.md#the-plugin-store) and try or buy plugins with one click. Plugins can only be installed when [admin changes](config5:allowAdminChanges) are allowed.
## Tips + Tricks
diff --git a/docs/5.x/system/elements.md b/docs/5.x/system/elements.md
index 3caf3e3da..516eb1aef 100644
--- a/docs/5.x/system/elements.md
+++ b/docs/5.x/system/elements.md
@@ -139,7 +139,7 @@ Both chips and cards support thumbnails, but only cards allow additional custom
#### Custom Card Attributes
-The attributes and fields displayed on element cards is ultimately determined by the interface below each field layout designer:
+The attributes and fields displayed on element cards is ultimately determined by the interface below each [field layout designer](fields.md#field-layouts):
@@ -183,6 +183,8 @@ As an example, if you wanted to customize the output of an asset in a volume wit
_partials/asset/images.twig
```
+For element types without a _field layout provider_ (like addresses and users)—or when a more specific template is not found—Craft falls back to just the `refHandle`. In the example above, if `_partials/assets/images.twig` doesn’t exist, `_partials/asset.twig` would also be checked.
+
If some property of the asset (like its extension, or the user group its uploader is in) should affect its template, you can put whatever logic you need into the template and render something different:
```twig
diff --git a/docs/5.x/system/fields.md b/docs/5.x/system/fields.md
index e813c00f7..ca23c3073 100644
--- a/docs/5.x/system/fields.md
+++ b/docs/5.x/system/fields.md
@@ -8,9 +8,9 @@ sidebarDepth: 2
# Custom Fields
-On their own, [elements](elements.md) only provide a scaffold for your content—the content itself will be stored in *fields*.
+On their own, [elements](elements.md) only provide a scaffold for your content—most of the content itself will be stored in *fields*.
-Fields are managed in **Settings** → **Fields**, and can be created on-the-fly from a [field layout](#field-layouts) designer. Field layouts and [conditions](#conditions) determine where and when your fields should appear for content authors.
+Fields are managed in , and can be created on-the-fly from a [field layout](#field-layouts) designer. Field layouts and [conditions](#conditions) determine where and when your fields should appear for content authors.
## Field Types
@@ -28,7 +28,7 @@ Choosing a field type determines what the field’s input UI is going to look l
-Most field types share a few settings.
+Most field types share these core settings:
Name
: The user-facing label for the field. This should identify the field reasonably well among other fields, and be descriptive enough for authors. _You can override this in a field layout._
@@ -63,7 +63,7 @@ Handles are used when accessing field data from code:
```
-They’re also how you will [query by a field’s value](../development/element-queries.md#querying-with-custom-fields):
+They’re also how you [query by a field’s value](../development/element-queries.md#querying-with-custom-fields):
```twig
{# Filter by the value of a lightswitch field: #}
@@ -76,7 +76,7 @@ Refer to each field type’s documentation for information about what kinds of d
### Translation Methods
-If you’re running a multi-site Craft installation, most of your fields will have a “Translation Method” setting (depending on their type).
+If you’re running a multi-site Craft installation, most of your fields will have a “Translation Method” setting.
Fields can have the following translation method:
@@ -108,21 +108,30 @@ Everything in Craft that has content associated with it will expose a configurab
- **[Users](../reference/element-types/users.md)** share a single field layout defined in **Settings** → **Users** → **User Fields**.
- **[Addresses](../reference/element-types/addresses.md)** also share a field layout, which can be found alongside **Users** in **Settings** → **Users** → **Address Fields**.
-The field layout editor works the same way regardless of which content type you’re configuring:
+The field layout editor works roughly the same way, regardless of which element type you’re configuring:
-
+
+
+::: tip
+Fields and other element-specific attributes can also be added to [element cards](elements.md#chips--cards) using the [card designer](#card-designer).
+:::
### Tabs
-Every layout starts with a “Content” tab at the top. Add more tabs with the **New Tab** button, or update an existing tab by clicking its gear icon ( ) and selecting **Settings**. Drag and drop those tabs into whatever order you prefer—the first tab is selected by default when editing an entry.
+Every layout starts with a _Content_ tab. Add more tabs with the **New Tab** button, or update an existing tab by clicking its action button ( ) and selecting **Settings**. Drag and drop those tabs into whatever order you prefer—the first tab is selected by default when editing an entry.
::: tip
-If the field layout has only one tab (or only one tab is visible due to applied conditions), its fields will be displayed in the editor without the tab itself—so its name will not be visible until more tabs are added.
+When editing an element, if its field layout has only one tab (or only one tab is visible due to applied conditions), the fields within it will be displayed _without_ the tab or tab bar. Its name will not be visible until there are at least two tabs.
:::
A tab’s settings include its name and optional conditions that determine when it will be displayed for editors:
-
+
+
+
- **Name** – the label displayed for the tab when it’s visible in the editor.
- **Current User Condition** – optional rules for determining which users should see the tab in the editor. (When the tab is not displayed, its fields are hidden regardless of their individual conditions.)
@@ -130,17 +139,28 @@ A tab’s settings include its name and optional conditions that determine when
### Field Layout Elements
-Add however many fields you’d like to each tab, dragging them into your desired order. Most layouts include at least a **Title** field by default—even if it’s marked as _hidden_. Any available fields and UI elements will be available at the right edge of the layout designer, where you can drag them from the sidebar into your field layout. You can move fields back to the sidebar and out of your field layout (unless they’re _mandatory_ fields for the element type), but take care not to remove any fields already being used for important content.
+Add fields to any tab using the **+ Add** button, then dragging them into the desired order. Most layouts include at least a **Title** field by default—even if it’s marked as _hidden_. To remove a field, select **Remove** from its action menu. Some field layout elements are designated as _mandatory_ by an element type, meaning they cannot be removed from its field layout.
+
+::: warning
+Take care when removing a field from a layout: Craft stores field content using each instance’s UID. _Re-adding a field (whether or not it uses the same handle) will give it a new UID, meaning it will no longer be associated with existing content!_ By relegating these changes to a development environment, your live data is typically insulated from major loss—if you do mistakenly remove a field, you can always roll back the corresponding [project config](project-config.md) changes via git before deploying.
+
+Moving field layout elements between tabs, however, is nondestructive.
+:::
-By default, each field will be displayed at the full width (100%) of its tab. You can use the field width control, however, to designate a column size. This can be 25%, 50%, 75% or the default 100% width. Fields can appear side by side as long as the content editor’s browser window is wide enough. On small screens, fields may be shown at full width.
+By default, each field will be displayed at the full width (100%) of its tab. Use the field width control to adjust this in increments of 25%. Fields can appear side by side as long as the content editor’s browser window is wide enough. On narrow screens, fields may be shown at full width, even if they are configured differently.
-Click the gear icon ( ) next to a field to open a slideout with its settings:
+Click the action button ( ) next to a field and select **Instance settings** to open a slideout with its settings:
-
+
+
+
The field’s settings let you control how and when it’s displayed:
-- **Label** – Override the field’s default label.
+- **Label** – Override the field’s default label, or hide it entirely.
- **Handle** – Override the field’s handle.
- **Instructions** – Override the field’s default instructions.
- **Current User Condition** – Set rules for determining which users can see the field and change its value.
@@ -153,7 +173,7 @@ The field’s settings let you control how and when it’s displayed:
Only one field can be used as an element’s thumbnail at a time.
:::
-Some field layout elements’ settings are bubbled up to the layout designer, beside the field’s name:
+Some field layout elements’ settings are bubbled up to the layout designer as _indicators_, beside the field’s name:
- An _asterisk_ ( ) means the field is **Required**.
- A _diamond_ means that it has been assigned one or more user or element [condition rules](#conditions).
@@ -161,9 +181,11 @@ Some field layout elements’ settings are bubbled up to the layout designer, be
- An _eye_ means the field will appear in element cards.
- A _pencil_ icon indicates that the field contains overridden settings.
+You can also edit the original field’s configuration by selecting **Edit global field settings** from its action menu.
+
### Multi-Instance Fields
-Most fields can be added to a single layout multiple times. Craft will automatically assign a new handle to fields that are used more than once in a layout. To customize a field’s handle for a given layout, click the settings icon on the field layout element and change the **Handle** setting.
+Most fields can be added to a single layout multiple times. Craft will automatically assign a new handle to fields that are used more than once in a layout. To customize a field’s handle for a given layout, click its action button ( ) and select **Instance settings** slideout, then look for the **Handle** field.
Multi-instance fields behave as though they were entirely different fields, in almost every situation: templates, element queries, condition builders, search, and so on. The field layout will retain a reference to the underlying field, so any settings updated for the base field will be reflected on each instance. For example, a [plain text](../reference/field-types/plain-text.md) field named “Attribution” could be used two (or more) times in a single entry type’s field layout: once for an article “Byline,” then again as “Photo Credit.” In a template, you would use those fields exactly like any other field:
@@ -216,18 +238,30 @@ Any fields (or [tabs](#tabs)) that have a **Current User Condition** or **Elemen
Conditions determine when (and to whom) a field or tab is displayed and validated. You can create sophisticated editorial processes by exposing parts of the authoring interface only when specific criteria are met.
::: warning
-Conditions are not intended as a complete substitute for [permissions](user-management.md#permissions)! It’s still important to configure sensible base permissions for your editors.
+Conditions are not intended as a substitute for [permissions](user-management.md#permissions)! It’s still important to configure sensible base permissions for your editors.
:::
### UI Elements
-Switch to the **UI Elements** tab at the right edge of the screen (replacing the **Fields** browser) to add special field layout elements.
+Switch to the **UI Elements** tab in the **New field** popover to add special field layout elements:
- **Heading** — Create a label that splits up form inputs, within a tab.
-- **Tip** & **Warning** — Display a message with the corresponding urgency. Equivalent, except in visual design.
+- **Tip** + **Warning** — Display a message with the corresponding urgency. Equivalent, except in visual design.
- **Template** — Render a Twig template from your [`templates/` directory](directory-structure.md#templates). The template will receive the element being edited under an `element` variable.
- **Horizontal Rule** — A thin divider line. Subsequent fields will start in a new row.
- **Line Break** — An invisible element that ensures the next field is rendered in a new row.
-- **Markdown** — Renders a multi-line Markdown snippet.
+- **Markdown** — Renders a multi-line Markdown snippet. HTML is encoded prior to parsing as Markdown; if you want to add arbitrary HTML, use the **Template** UI element.
In addition to their own options (accessible via their action menu), most field layout UI elements share regular fields’ [condition](#conditions) settings.
+
+### Card Designer
+
+Below the field layout designer, you can add previews of field and attribute data to the [card](elements.md#chips-cards) representation of that element. Note that values that appear in the card preview do not represent the content of any specific element.
+
+
+
+#### Thumbnails
+
+Card thumbnails are assigned using the main field layout designer. Select **Use for element thumbnails** from the action menu of any [relational field](relations.md) to display the first attached asset—or, when using a non-asset relational field, _that_ element’s thumbnail!
+
+Only one field can be used as the thumbnail source at a time. Additional asset fields’ values can be displayed in the card body, as chips.
diff --git a/docs/5.x/system/mail.md b/docs/5.x/system/mail.md
index 78216cc5c..a1f346622 100644
--- a/docs/5.x/system/mail.md
+++ b/docs/5.x/system/mail.md
@@ -6,19 +6,19 @@ Plugins may send email under other circumstances, either by registering a global
## System Messages
-You can view and edit the built-in (and plugin-provided) email messages by navigating to **Utilities** → **System Messages**.
+You can view and edit the built-in (and plugin-provided) email messages by navigating to .
+ caption="Viewing system messages in the utilities section of the control panel. Customizing system messages is limited to Craft Pro.">
Click on any message to open a modal and edit its subject and body.
::: tip
-Running a multi-site installation? You can customize system messages on a per-site basis using the site selection menu in the upper-right corner of the message modal.
+Running a [multi-site](sites.md) installation? You can customize system messages (and [mail settings](#settings)) on a per-site basis using the site selection menu in the upper-right corner of the message editor modal.
:::
### Twig
@@ -120,8 +120,9 @@ Craft uses a single configuration for its [mailer component](craft5:craft\mail\M
:poi="{
systemAddress: [28, 14],
replyToAddress: [28, 22],
- htmlTemplate: [28, 38.5],
- transportAdapter: [20, 52],
+ htmlTemplate: [28, 39.5],
+ siteOverrides: [48, 52],
+ transportAdapter: [18, 62],
}"
caption="Email settings screen in the control panel.">
@@ -177,7 +178,13 @@ This template is handled a bit differently than the normal Twig “layout” sch
Otherwise, this is a regular Twig environment, so all the filters, functions, global variables, tags, and tests are available to you—including element queries!
-### Transport Adapters
+### Site Overrides
+
+Multi-site projects provide a means to override the **System Email Address**, **Reply-To Address**, **Sender Name**, and **HTML Email Template** on a site-by-site basis. Like the fields above, overrides accept environment variables that are resolved at runtime. When a value is not populated for a site, the global setting is used.
+
+Craft uses site-specific settings when sending email to users with an [affiliated site](user-management.md#affiliated-site).
+
+### Transport Adapters
Three adapters are provided with Craft, with more installable from the [Plugin Store](https://plugins.craftcms.com/categories/mailer-adapters?craft4). You can switch adapters at any time—each adapter exposes a [Transport](https://symfony.com/doc/current/mailer.html#using-a-3rd-party-transport) class that conforms to a consistent interface, allowing Craft and plugins to send email without worrying about the underlying implementation or service.
diff --git a/docs/5.x/system/user-management.md b/docs/5.x/system/user-management.md
index 30e0fecaa..2a69b8c91 100644
--- a/docs/5.x/system/user-management.md
+++ b/docs/5.x/system/user-management.md
@@ -129,59 +129,60 @@ The permissions Craft comes with are:
| ---------- | ------
| Access the site when the system is off | `accessSiteWhenSystemIsOff`
| Access the control panel | `accessCp`
-| ↳ Access the control panel when the system is offline | `accessCpWhenSystemIsOff`
-| ↳ Perform Craft CMS and plugin updates | `performUpdates`
-| ↳ Access Plugin Name | `accessPlugin-[PluginHandle]`
-| Edit users | `editUsers`
-| ↳ Register users | `registerUsers`
-| ↳ Moderate users Moderation includes editing other users’ names, usernames, custom fields, and addresses. | `moderateUsers`
-| ↳ Administrate users User administration includes changing emails, sending activation and password reset emails, setting passwords, and deactivating users. This permission can be used to elevate one’s own permissions by gaining access to other administrators’ accounts! | `administrateUsers`
-| ↳ Impersonate users User impersonation allows one user to temporarily access the site as though they were another user with the same (or more restrictive) permissions. | `impersonateUsers`
-| ↳ Assign user permissions | `assignUserPermissions`
-| ↳ Assign users to this group This is not an actual permission so much as a convenience feature for automatically granting the ability to add peers to the group you are currently editing, as its handle may not be known, yet! | See note.
-| ↳ Assign users to Group Name | `assignUserGroup:[UserGroupUID]`
-| Delete users | `deleteUsers`
+| Access the control panel when the system is offline | `accessCpWhenSystemIsOff`
+| Perform Craft CMS and plugin updates | `performUpdates`
+| Access Plugin Name | `accessPlugin-[PluginHandle]`
+| View users Read-only access to user elements. In earlier versions of Craft, user management permissions were not nested within this one. | `viewUsers`
+| Edit users | `editUsers`
+| Register users | `registerUsers`
+| Moderate users Moderation includes editing other users’ names, usernames, custom fields, and addresses. | `moderateUsers`
+| Administrate users User administration includes changing emails, sending activation and password reset emails, setting passwords, and deactivating users. This permission can be used to elevate one’s own permissions by gaining access to other administrators’ accounts! | `administrateUsers`
+| Impersonate users User impersonation allows one user to temporarily access the site as though they were another user with the same (or more restrictive) permissions. | `impersonateUsers`
+| Assign user permissions | `assignUserPermissions`
+| Assign users to this group This is not an actual permission so much as a convenience feature for automatically granting the ability to add peers to the group you are currently editing, as its handle/UUID may not be known, yet! | See note.
+| Assign users to Group Name | `assignUserGroup:[UserGroupUID]`
+| Delete users | `deleteUsers`
| Edit Site Name Site permissions are intersected with other permissions. A user will only be able to edit something if they have access to the site and the element itself. | `editSite:[SiteUID]`
| View entries This section is repeated for each configured section. | `viewEntries:[SectionUID]`
-| ↳ Create entries | `createEntries:[SectionUID]`
-| ↳ Save entries | `saveEntries:[SectionUID]`
-| ↳ Delete entries | `deleteEntries:[SectionUID]`
-| ↳ View other users’ entries | `viewPeerEntries:[SectionUID]`
-| ↳ Save other users’ entries | `savePeerEntries:[SectionUID]`
-| ↳ Delete other users’ entries | `deletePeerEntries:[SectionUID]`
-| ↳ View other users’ drafts | `viewPeerEntryDrafts:[SectionUID]`
-| ↳ Save other users’ drafts | `savePeerEntryDrafts:[SectionUID]`
-| ↳ Delete other users’ drafts | `deletePeerEntryDrafts:[SectionUID]`
+| Create entries | `createEntries:[SectionUID]`
+| Save entries | `saveEntries:[SectionUID]`
+| Delete entries | `deleteEntries:[SectionUID]`
+| View other users’ entries | `viewPeerEntries:[SectionUID]`
+| Save other users’ entries | `savePeerEntries:[SectionUID]`
+| Delete other users’ entries | `deletePeerEntries:[SectionUID]`
+| View other users’ drafts | `viewPeerEntryDrafts:[SectionUID]`
+| Save other users’ drafts | `savePeerEntryDrafts:[SectionUID]`
+| Delete other users’ drafts | `deletePeerEntryDrafts:[SectionUID]`
| Edit Global Set Name | `editGlobalSet:[GlobalSetUID]`
| View categories This section is repeated for each configured category group. | `viewCategories:[CategoryGroupUID]`
-| ↳ Save categories | `saveCategories:[CategoryGroupUID]`
-| ↳ Delete categories | `deleteCategories:[CategoryGroupUID]`
-| ↳ View other users’ drafts | `viewPeerCategoryDrafts:[CategoryGroupUID]`
-| ↳ Save other users’ drafts | `savePeerCategoryDrafts:[CategoryGroupUID]`
-| ↳ Delete other users’ drafts | `deletePeerCategoryDrafts:[CategoryGroupUID]`
+| Save categories | `saveCategories:[CategoryGroupUID]`
+| Delete categories | `deleteCategories:[CategoryGroupUID]`
+| View other users’ drafts | `viewPeerCategoryDrafts:[CategoryGroupUID]`
+| Save other users’ drafts | `savePeerCategoryDrafts:[CategoryGroupUID]`
+| Delete other users’ drafts | `deletePeerCategoryDrafts:[CategoryGroupUID]`
| View assets | `viewAssets:[VolumeUID]`
-| ↳ Save assets | `saveAssets:[VolumeUID]`
-| ↳ Delete assets | `deleteAssets:[VolumeUID]`
-| ↳ Replace files | `replaceFiles:[VolumeUID]`
-| ↳ Edit images | `editImages:[VolumeUID]`
-| ↳ View assets uploaded by other users | `viewPeerAssets:[VolumeUID]`
-| ↳ Save assets uploaded by other users | `savePeerAssets:[VolumeUID]`
-| ↳ Replace files uploaded by other users | `replacePeerFiles:[VolumeUID]`
-| ↳ Remove files uploaded by other users | `deletePeerAssets:[VolumeUID]`
-| ↳ Edit images uploaded by other users | `editPeerImages:[VolumeUID]`
-| ↳ Create subfolders | `createFolders:[VolumeUID]`
+| Save assets | `saveAssets:[VolumeUID]`
+| Delete assets | `deleteAssets:[VolumeUID]`
+| Replace files | `replaceFiles:[VolumeUID]`
+| Edit images | `editImages:[VolumeUID]`
+| View assets uploaded by other users | `viewPeerAssets:[VolumeUID]`
+| Save assets uploaded by other users | `savePeerAssets:[VolumeUID]`
+| Replace files uploaded by other users | `replacePeerFiles:[VolumeUID]`
+| Remove files uploaded by other users | `deletePeerAssets:[VolumeUID]`
+| Edit images uploaded by other users | `editPeerImages:[VolumeUID]`
+| Create subfolders | `createFolders:[VolumeUID]`
| Utilities |
-| ↳ Updates | `utility:updates`
-| ↳ System Report | `utility:system-report`
-| ↳ PHP Info | `utility:php-info`
-| ↳ System Messages | `utility:system-messages`
-| ↳ Asset Indexes | `utility:asset-indexes`
-| ↳ Queue Manager | `utility:queue-manager`
-| ↳ Caches | `utility:clear-caches`
-| ↳ Deprecation Warnings | `utility:deprecation-errors`
-| ↳ Database Backup | `utility:db-backup`
-| ↳ Find and Replace | `utility:find-replace`
-| ↳ Migrations | `utility:migrations`
+| Updates | `utility:updates`
+| System Report | `utility:system-report`
+| PHP Info | `utility:php-info`
+| System Messages | `utility:system-messages`
+| Asset Indexes | `utility:asset-indexes`
+| Queue Manager | `utility:queue-manager`
+| Caches | `utility:clear-caches`
+| Deprecation Warnings | `utility:deprecation-errors`
+| Database Backup | `utility:db-backup`
+| Find and Replace | `utility:find-replace`
+| Migrations | `utility:migrations`
You may not see all of these options, initially—only ones that are relevant based on the current content schema will be displayed. For example, everything under _View categories_ will be hidden until you have at least one [category group](../reference/element-types/categories.md#category-groups).
@@ -299,6 +300,10 @@ Once you set up your site to allow public user registration, the last step is to
By default, Craft puts new users in a [pending state](#statuses) and allows them to activate their own accounts via email. You can instead select **Deactivate users by default** to place a moderation buffer between public registration and eventual access.
:::
+### Affiliated Site
+
+During registration, Craft captures the current [site](sites.md) and stores it as the user’s **Affiliated Site**. This is primarily used to determine what language [system emails](mail.md#system-messages) should be sent in, when dispatched in site-agnostic contexts (like the control panel or from a CLI command).
+
### Default Group
Users created via public registration are automatically added to the group designated by the **Default User Group** setting.