From ec674068c703128f7b71b21a31945755df720d32 Mon Sep 17 00:00:00 2001 From: Yuri Salimovskiy Date: Wed, 11 Oct 2023 11:45:58 +0300 Subject: [PATCH 1/2] {exp:channel:field} tag --- docs/channels/fields.md | 79 +++++++++++++++++++++ docs/toc_sections/_the_fundamentals_toc.yml | 3 +- 2 files changed, 81 insertions(+), 1 deletion(-) create mode 100644 docs/channels/fields.md diff --git a/docs/channels/fields.md b/docs/channels/fields.md new file mode 100644 index 000000000..a1c41e397 --- /dev/null +++ b/docs/channels/fields.md @@ -0,0 +1,79 @@ + + +# Channel Field Tag + +[TOC] + +## Overview + +`{exp:channel:field}` tag allows displaying properties of [channel field](control-panel/field-manager/edit-field.md) irrespective of the context. + + {exp:channel:field field_name="department"} +

Choose {field_label}:

+ {field_options} +

{value}: {label}

+ {/field_options} + + {/exp:channel:field} + +## Parameters + +### `field_id=` + + field_id="2" + +Specify field ID. It is required to have either field_id or field_name parameter. If both are specified, field_id will be used. + +### `field_name=` + + field_name="body" + +Specify field name. It is required to have either field_id or field_name parameter. + +### `site_id=` + + site_id="2" + +By default, the tag is looking for fields that are set up for current MSM site. If you need to display properties of field that belongs to other MSM site, you need to specify site_id parameter. + + +## Variables + +[TOC=3] + +### `{field_id}` + +Field ID + +### `{field_name}` + +Field name + +### `{field_label}` + +Field label + +### `{field_instructions}` + +Field instructions for the CP + +### `{field_type}` + +Field type + +### `{field_options}` + +Tag pair that contains possible field options. It is used for fields like Radio Buttons, Checkboxes, Select Dropdown, etc. + +Inside the tag pair you can use `{value}` and `{label}` variables: + + {field_options} + {value} / {label} + {/field_options} \ No newline at end of file diff --git a/docs/toc_sections/_the_fundamentals_toc.yml b/docs/toc_sections/_the_fundamentals_toc.yml index 18effcaef..80f7dad36 100644 --- a/docs/toc_sections/_the_fundamentals_toc.yml +++ b/docs/toc_sections/_the_fundamentals_toc.yml @@ -211,6 +211,8 @@ href: channels/channel-form/categories.md - name: Development href: channels/channel-form/development.md + - name: Channel Field Properties + href: channels/fields.md #If you update fieldtypes besure to update listing on fieldtypes/overview page. - name: Fieldtypes @@ -313,4 +315,3 @@ href: comment/subscriptions.md - name: Control Panel href: comment/control-panel.md - From bccfc7202302c24e09000bf9ede95252cf0467a0 Mon Sep 17 00:00:00 2001 From: Bryan Nielsen Date: Mon, 8 Jul 2024 11:49:59 -0400 Subject: [PATCH 2/2] Add missing div to exp:channel:field example --- docs/channels/fields.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/channels/fields.md b/docs/channels/fields.md index a1c41e397..8849d0417 100644 --- a/docs/channels/fields.md +++ b/docs/channels/fields.md @@ -16,7 +16,8 @@ `{exp:channel:field}` tag allows displaying properties of [channel field](control-panel/field-manager/edit-field.md) irrespective of the context. {exp:channel:field field_name="department"} -

Choose {field_label}:

+
+

Choose {field_label}:

{field_options}

{value}: {label}

{/field_options}