Skip to content

Commit e612ba7

Browse files
committed
Move index and add more placeholder info
1 parent 6522a8a commit e612ba7

File tree

3 files changed

+28
-11
lines changed

3 files changed

+28
-11
lines changed

en/02_ContentBlocks/v1.x/-Fields.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
title: Fields (moved)
3+
---
4+
5+
[This page has moved.](Fields)

en/02_ContentBlocks/v1.x/01_Fields/Templates.md

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,26 @@ Field templates can be found by editing a [field in the ContentBlocks component]
22

33
## Placeholders
44

5-
Templates use the standard MODX parser, and have access to a number of placeholders in the form of `[[+KEY]]`. Which placeholders exactly depend on the [input type](../Input_Types).
5+
Templates use the standard MODX parser, and have access to a number of placeholders in the form of `[[+KEY]]`.
6+
7+
Which placeholders exactly depend on the [input type](../Input_Types). In the ContentBlocks component you can hover over the "Template" label to see available placeholders for the selected input type in the tooltip.
8+
9+
In most cases, you'll have at least a `[[+value]]` placeholder. Any field settings you add are also available as `[[+name_of_setting]]`.
610

711
All field templates have access to a set of shared placeholders:
812

13+
- `[[+idx]]`, an incrementing index for the fields inside the current layout column.
14+
- `[[+unique_idx]]`, a guaranteed to be unique incrementing index. This index number is incremented for each field or layout that is processed, nested layouts included, meaning the order is dependant on the exact page structure. You can **not** rely on two fields side-by-side being one index apart.
915
- `[[+layout_id]]`, the ID of the parent layout the field is inserted in.
1016
- `[[+layout_column]]`, the string name of the column the field is inserted in.
11-
- `[[+idx]]`, an incrementing index for the fields inside the current column.
12-
- `[[+unique_idx]]`, a guaranteed to be unique incrementing index. This index number is incremented for each field or layout that is processed, nested layouts included, meaning the order is dependant on the exact page structure. You can **not** rely on two fields side-by-side being one index apart.
1317
- `[[+layout_idx]]`, an incrementing index for the position of the layout on the page.
18+
- `[[+layout_title]]`, the title of the layout (user-editable by clicking on it in the interface); may be empty.
19+
20+
It's also possible to access layout settings in field templates (as of v1.8.3). Those are available with the `layout_settings` prefix, for example:
21+
22+
```
23+
[[+layout_settings.my_setting_key]
24+
```
1425

1526
## Using @CHUNK
1627

en/02_ContentBlocks/v1.x/01_Fields.md renamed to en/02_ContentBlocks/v1.x/01_Fields/index.md

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Fields are implementation of an [Input Type](Input_Types) (such as _heading_ or _gallery_), which defines how the content added by an editor is turned into the markup. As input types often provide a number of other properties for defining how it works or what it can do, you can have multiple configurations of that with multiple fields of the same input type.
1+
Fields are implementation of an [Input Type](../Input_Types) (such as _heading_ or _gallery_), which defines how the content added by an editor is turned into the markup. As input types often provide a number of other properties for defining how it works or what it can do, you can have multiple configurations of that with multiple fields of the same input type.
22

33
To give a simple example, you may define "Note" and "Warning" fields so editors can add callout blocks into the content. These fields would both be a _textarea_ or _richtext_ input type, but because their template is different, they provide vastly different use cases and visual styles in the front-end.
44

@@ -20,10 +20,10 @@ To manage fields, head over to Components and find the Content Blocks menu item.
2020

2121
On the General tab, you can edit the basic information for this field. That includes choosing the Input type, giving it a name, description and icon for in the _Add Content_ modal as well as defining the sort order.
2222

23-
- Input: a dropdown list with titles and descriptions of the currently existing [Input Types](Input_Types). This includes [custom inputs](Custom_Inputs/Developing_Custom_Inputs) as well as the built-in types. As soon as you choose an input type (Heading in the example), it will set the default icon for you and set some default properties in the Properties tab, but you are of course free to change this as you see fit.
23+
- Input: a dropdown list with titles and descriptions of the currently existing [Input Types](../Input_Types). This includes [custom inputs](../Custom_Inputs/Developing_Custom_Inputs) as well as the built-in types. As soon as you choose an input type (Heading in the example), it will set the default icon for you and set some default properties in the Properties tab, but you are of course free to change this as you see fit.
2424
- Name: the name the editor will see in the _Add Content_ modal. If you have multiple fields for the same input, you will probably give them a more distinctive name, but we'll settle for just "Heading" here.
2525
- Description: an optional description to add to the popup in the Add Content modal for the editor.
26-
- Icon: choose one of the many [included icons](Custom_Inputs/Icons), this is used in the _Add Content_ modal to quickly identify the field.
26+
- Icon: choose one of the many [included icons](../Custom_Inputs/Icons), this is used in the _Add Content_ modal to quickly identify the field.
2727
- Sort Order: the order in which to show the fields is defined by the sort order value. Lower numbers go first.
2828

2929

@@ -32,7 +32,7 @@ On the General tab, you can edit the basic information for this field. That incl
3232

3333
[![](https://assets.modmore.com/galleries/inline-418/2015/contentblocks_component_field_properties.png)](https://assets.modmore.com/galleries/inline-418/2015/contentblocks_component_field_properties.png)
3434

35-
The properties tab consists input-specific properties. All inputs have a template, which typically has a `[[+value]]` placeholder but depending on the [input type](Input_Types) there can be more or different placeholders, templates and other properties. By hovering over the properties you will get a tooltip with more information about the property, which typically includes the available placeholders along with general instructions.
35+
The properties tab consists input-specific properties. All inputs have a template, which typically has a `[[+value]]` placeholder but depending on the [input type](../Input_Types) there can be more or different placeholders, templates and other properties. By hovering over the properties you will get a tooltip with more information about the property, which typically includes the available placeholders along with general instructions.
3636

3737

3838

@@ -62,7 +62,7 @@ When fields are, based on the conditions, not allowed to be used, existing insta
6262

6363
[![](https://assets.modmore.com/galleries/inline-418/2015/contentblocks_component_field_settings.png)](https://assets.modmore.com/galleries/inline-418/2015/contentblocks_component_field_settings.png)
6464

65-
Settings are, [just like Layout Settings](Layouts), configuration options that you can add to a field which the Editor can then change when adding content to it. Settings are added as placeholders to the field's template so you can easily pass, for example, a class or inline style to a fields template. In the image above we have defined a "Class" setting (which will fill the `[[class]]` placeholder in our template, defined on the Properties tab) with a select field type and a couple of values.
65+
Settings are, [just like Layout Settings](../Layouts), configuration options that you can add to a field which the Editor can then change when adding content to it. Settings are added as placeholders to the field's template so you can easily pass, for example, a class or inline style to a fields template. In the image above we have defined a "Class" setting (which will fill the `[[class]]` placeholder in our template, defined on the Properties tab) with a select field type and a couple of values.
6666

6767
There's also an option called _Expose Fields_. This option allows you to define how the setting is made available to the editor, which is one of the following:
6868

@@ -82,6 +82,7 @@ Clicking the cog symbol will open the "Headline Settings" modal (we named our fi
8282

8383
## More information...
8484

85-
- [Built-in input types](Input_Types)
86-
- [Layouts](Layouts)
87-
- [Custom input types](Custom_Inputs/Developing_Custom_Inputs)
85+
- [Field Templates](Templates)
86+
- [Built-in input types](../Input_Types)
87+
- [Layouts](../Layouts)
88+
- [Custom input types](../Custom_Inputs/Developing_Custom_Inputs)

0 commit comments

Comments
 (0)