From 35d0389da7a3fd331aa0f1511766a69383ea41b7 Mon Sep 17 00:00:00 2001 From: Yuri Salimovskiy Date: Thu, 17 Nov 2022 17:12:06 +0200 Subject: [PATCH 1/4] field groups in Fluid --- .../field-manager/field-manager-settings.md | 6 +- docs/fieldtypes/fluid.md | 60 ++++++++++++++++++- 2 files changed, 63 insertions(+), 3 deletions(-) diff --git a/docs/control-panel/field-manager/field-manager-settings.md b/docs/control-panel/field-manager/field-manager-settings.md index 5b8833e5e..9c1cc314b 100644 --- a/docs/control-panel/field-manager/field-manager-settings.md +++ b/docs/control-panel/field-manager/field-manager-settings.md @@ -40,4 +40,8 @@ Fields have the following settings: **Control Panel Location: `Developer > Fields > Field Groups > New/Edit Field Group`** -This section allows you to create and edit field groups. Field Groups are collections of fields which can then be related to one or more [Channels](control-panel/channels.md#fields-tab). +This section allows you to create and edit field groups. Field Groups are collections of fields which can then be related to one or more [Channels](control-panel/channels.md#fields-tab) as well as used in [Fluid fields](fieldtypes/fluid.md). + +The field group details and assigned fields can be edited by clicking pencil icon next to field group name. + +Clicking on the group name will show the list of fields assigned to this group. The fields can be reordered by drag and drop, and the fields order will be respected on [Entry Publish page](control-panel/create.md) (unless [Publish Layouts](control-panel/channels.md#publish-layouts) are used) as well as in [Fluid field custom field groups](fieldtypes/fluid.md#custom-field-groups). diff --git a/docs/fieldtypes/fluid.md b/docs/fieldtypes/fluid.md index 131438008..949de7fb3 100755 --- a/docs/fieldtypes/fluid.md +++ b/docs/fieldtypes/fluid.md @@ -23,13 +23,19 @@ Fluid fields give the author control over the structure of their content, while Select all fields that you want available in your fluid field on the publish page. All native fieldtypes except another fluid field are available. +### Custom field groups + +Select custom field groups to make them available to fluid field on the publish page. All fields in group will be displayed together in the order set on field group page. + ## Publish Page ### Add -A fluid field is initially displayed as a simple dropdown 'Add', populated with the field names assigned to the fluid field. When you choose a field from the dropdown, it adds it to the page, maintaing all of the field's settings, instructions and requirements. +Each fluid field has list of buttons of available custom fields and custom field groups displayed below. Clicking on the button adds a field (or field group) to Fluid, maintaing all of the field's settings, instructions and requirements. -Fields can be used more than once and in any order. They can be re-ordered within the fluid field by dragging up or down. +Also each Fluid row has '+' button, clicking which shows a dropdown populated with the field names assigned to the fluid field. When you choose a field from the dropdown, it adds it to the page + +Fields (or field groups) can be used more than once and in any order. They can be re-ordered within the fluid field by dragging up or down. The frontend will output the various field contents in the order specified in the entry. @@ -53,6 +59,24 @@ For example, if you have a Fluid field `fluid_content` with a text field `fluid_ The prefixed tag pair is a looping tag pair. You can have more than one `fluid_text` field for the entry, it's entirely at the entry author's discretion. The author also determines the order of the field output. +Displaying field groups from within Fluid field is sligtly different, as it requires additions `{fields}` tag pair. +So given that `blog` is the name of custom field group and `fluid_header` and `fluid_text` are fields in that group, the template might look like: + + {fluid_content} + + {fluid_content:blog} + {fields} + {fluid_content:fluid_header} +

{content}

+ {/fluid_content:fluid_header} + {fluid_content:fluid_text} +
{content}
+ {/fluid_content:fluid_text} + {/fields} + {/fluid_content:blog} + + {/fluid_content} + ## Variables TIP: **Tip:** When using any of these [tags with a parameter in a conditional](templates/conditionals.md#embedding-tags) you will have to wrap them in braces (`{}`), like so: `{if {fluid_content:first name="text_body"}}` @@ -149,6 +173,38 @@ Alias of `:current_fieldtype`. The total number of fields regardless of tag output criteria. +Additionally, the following variable are available when using custom field groups: + +### `first_group` + + {fluid_content:first_group} + +True, if the current field group is the first one. + +### `last_group` + + {fluid_content:first_group} + +True, if the current field group is the last one. + +### `current_group_name` + + {fluid_content:current_group_name} + +The name of the current field group being processed. + +### `next_group_name` + + {fluid_content:next_group_name} + +The name of the next field group. This will be blank when on the last group. + +### `prev_group_name` + + {fluid_content:prev_group_name} + +The name of the previous field group. This will be blank when on the first group. + ## Displaying a Pair variable Fields that use a variable pair to output content work like they would outside of a Fluid field, with the the `{content}` variable taking the place of the field shortname. From a31d600410e1c544f99bd940dda730f0cfadc0e0 Mon Sep 17 00:00:00 2001 From: Yuri Salimovskiy Date: Mon, 22 May 2023 07:41:41 +0300 Subject: [PATCH 2/4] Update fluid.md --- docs/fieldtypes/fluid.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/fieldtypes/fluid.md b/docs/fieldtypes/fluid.md index 949de7fb3..96aa9498e 100755 --- a/docs/fieldtypes/fluid.md +++ b/docs/fieldtypes/fluid.md @@ -39,6 +39,8 @@ Fields (or field groups) can be used more than once and in any order. They can b The frontend will output the various field contents in the order specified in the entry. +NOTE: **Note:** Conditional fields are not supported inside Fluid + ## Channel Form A fluid field cannot be used in the channel form. From dd56bb011ea837a94231a80cdc5159569b1471e4 Mon Sep 17 00:00:00 2001 From: Yuri Salimovskiy Date: Fri, 2 Jun 2023 10:34:10 +0300 Subject: [PATCH 3/4] update to use field group short names --- .../field-manager/field-manager-settings.md | 9 ++++++- docs/fieldtypes/fluid.md | 26 ++++++++++++++++--- 2 files changed, 30 insertions(+), 5 deletions(-) diff --git a/docs/control-panel/field-manager/field-manager-settings.md b/docs/control-panel/field-manager/field-manager-settings.md index 9c1cc314b..f9eb6c75a 100644 --- a/docs/control-panel/field-manager/field-manager-settings.md +++ b/docs/control-panel/field-manager/field-manager-settings.md @@ -44,4 +44,11 @@ This section allows you to create and edit field groups. Field Groups are collec The field group details and assigned fields can be edited by clicking pencil icon next to field group name. -Clicking on the group name will show the list of fields assigned to this group. The fields can be reordered by drag and drop, and the fields order will be respected on [Entry Publish page](control-panel/create.md) (unless [Publish Layouts](control-panel/channels.md#publish-layouts) are used) as well as in [Fluid field custom field groups](fieldtypes/fluid.md#custom-field-groups). +Clicking on the group name will show the list of fields assigned to this group. + +Fields groups have following properties: + +- **Name** -- Name of field group displayed in Control Panel +- **Short Name** -- The short name of field group, used in Fluid fields when looping through the group's fields +- **Description** -- Description of field group. Displayed in Fluid field on Edit Entry page where this group is used +- **Fields** -- The fields can be reordered by drag and drop, and the fields order will be respected on [Entry Publish page](control-panel/create.md) (unless [Publish Layouts](control-panel/channels.md#publish-layouts) are used) as well as in [Fluid field custom field groups](fieldtypes/fluid.md#custom-field-groups). \ No newline at end of file diff --git a/docs/fieldtypes/fluid.md b/docs/fieldtypes/fluid.md index 96aa9498e..1d05c13c4 100755 --- a/docs/fieldtypes/fluid.md +++ b/docs/fieldtypes/fluid.md @@ -62,7 +62,7 @@ For example, if you have a Fluid field `fluid_content` with a text field `fluid_ The prefixed tag pair is a looping tag pair. You can have more than one `fluid_text` field for the entry, it's entirely at the entry author's discretion. The author also determines the order of the field output. Displaying field groups from within Fluid field is sligtly different, as it requires additions `{fields}` tag pair. -So given that `blog` is the name of custom field group and `fluid_header` and `fluid_text` are fields in that group, the template might look like: +So given that `blog` is the short name of custom field group and `fluid_header` and `fluid_text` are fields in that group, the template might look like: {fluid_content} @@ -193,19 +193,37 @@ True, if the current field group is the last one. {fluid_content:current_group_name} -The name of the current field group being processed. +The "human" name of the current field group being processed. + +### `current_group_short_name` + + {fluid_content:current_group_short_name} + +The short name of the current field group being processed (as used in the templates). ### `next_group_name` {fluid_content:next_group_name} -The name of the next field group. This will be blank when on the last group. +The "human" name of the next field group. This will be blank when on the last group. + +### `next_group_short_name` + + {fluid_content:next_group_short_name} + +The short name of the next field group. This will be blank when on the last group. ### `prev_group_name` {fluid_content:prev_group_name} -The name of the previous field group. This will be blank when on the first group. +The "human" name of the previous field group. This will be blank when on the first group. + +### `prev_group_short_name` + + {fluid_content:prev_group_short_name} + +The short name of the previous field group. This will be blank when on the first group. ## Displaying a Pair variable From e06f6c3d72b7786ae5f0f291a434109542c2281f Mon Sep 17 00:00:00 2001 From: Yuri Salimovskiy Date: Fri, 2 Jun 2023 10:41:34 +0300 Subject: [PATCH 4/4] no message --- docs/control-panel/field-manager/field-manager-settings.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/control-panel/field-manager/field-manager-settings.md b/docs/control-panel/field-manager/field-manager-settings.md index f9eb6c75a..bb2383700 100644 --- a/docs/control-panel/field-manager/field-manager-settings.md +++ b/docs/control-panel/field-manager/field-manager-settings.md @@ -50,5 +50,5 @@ Fields groups have following properties: - **Name** -- Name of field group displayed in Control Panel - **Short Name** -- The short name of field group, used in Fluid fields when looping through the group's fields -- **Description** -- Description of field group. Displayed in Fluid field on Edit Entry page where this group is used +- **Description** -- Description of field group - **Fields** -- The fields can be reordered by drag and drop, and the fields order will be respected on [Entry Publish page](control-panel/create.md) (unless [Publish Layouts](control-panel/channels.md#publish-layouts) are used) as well as in [Fluid field custom field groups](fieldtypes/fluid.md#custom-field-groups). \ No newline at end of file