Skip to content

Commit e5066a2

Browse files
authored
Merge pull request #665 from ExpressionEngine/7.3/beef-fluid-field-groups
Added some more examples
2 parents bbf329b + 15255f6 commit e5066a2

File tree

1 file changed

+64
-1
lines changed

1 file changed

+64
-1
lines changed

docs/fieldtypes/fluid.md

Lines changed: 64 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ In this example, the Fluid field has short name `news_content` with a file field
243243

244244
## Displaying Multiple Fields
245245

246-
Fluid fields are most useful when multiple fields may be included in the presentation. For example, you want to give your client the flexibility to add content in a number of styles. There's a text field `{full_text}`, a grid field `{img_card}` to hold a varying number of small images with descriptive text, a relationship field `{featured_entry}` where they can set a featured article.
246+
Fluid fields are most useful when multiple fields may be included in the presentation. For example, you want to give your client the flexibility to add content in a number of styles. There's a text field `{full_text}`, a grid field `{img_card}` to hold a varying number of small images with descriptive text, a relationship field `{featured_entry}` where they can set a featured article and an SEO `seo_group` **field group** containing multiple fields related to meta data.
247247

248248
A fluid field can handle the output of all of those fields, as many as they add, respecting the order they specify when publishing.:
249249

@@ -277,6 +277,17 @@ A fluid field can handle the output of all of those fields, as many as they add,
277277
</div>
278278
{/fluid_field:featured_entry}
279279
280+
{fluid_field:seo_group}
281+
{fields}
282+
{fluid_field:seo_title}
283+
<title>{content}</title>
284+
{/fluid_field:seo_title}
285+
{fluid_field:seo_description}
286+
<meta name="description" content="{content}">
287+
{/fluid_field:seo_description}
288+
{/fields}
289+
{/fluid_field:seo_group}
290+
280291
{/fluid_field}
281292
```
282293

@@ -429,3 +440,55 @@ Radio and single select fields use single variables:
429440
<a href="{content}">Your Link</a>
430441
{/my_fluid_field:my_url}
431442
{/my_fluid_field}
443+
444+
## Field Group Examples
445+
446+
Field groups in fluid work exactly like fields do, with one extra tag pair ``{fields}...{/fields}`` required.
447+
448+
### Field Group with Date and Email fields
449+
450+
{my_fluid_field}
451+
{my_fluid_field:my_field_group}
452+
{fields}
453+
454+
{my_fluid_field:my_date}
455+
{content format="%F %d %Y"}
456+
{/my_fluid_field:my_date}
457+
458+
{my_fluid_field:my_email}
459+
{content:mailto title="Email about their dog" subject="Question about your dog" encode="no"}
460+
{/my_fluid_field:my_email}
461+
462+
{/fields}
463+
{/my_fluid_field:my_field_group}
464+
{/my_fluid_field}
465+
466+
Field Group with Text and Relationship fields
467+
468+
### Field Group with Text and Relationship fields
469+
470+
{my_fluid_field}
471+
{my_fluid_field:my_field_group}
472+
{fields}
473+
474+
{my_fluid_field:my_textarea}
475+
{content}
476+
{/my_fluid_field:my_textarea}
477+
478+
{my_fluid_field:my_relationship}
479+
{content status="open"}
480+
{if content:count == 1}<h3>Relationships ({content:total_results})</h3>{/if}
481+
482+
Related entry title: {content:title}
483+
Related entry file field, med custom image size: {content:my_file:med wrap="image"}
484+
485+
Related field in the related child entry:
486+
{content:my_related_field_in_child_entry}
487+
{content:cmy_related_field_in_child_entry:title}
488+
{/content:my_related_field_in_child_entry}
489+
{/content}
490+
{/my_fluid_field:my_relationship}
491+
492+
{/fields}
493+
{/my_fluid_field:my_field_group}
494+
{/my_fluid_field}

0 commit comments

Comments
 (0)