We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

Fluid variables in grid fields

How Do I?

Fingo's avatar
Fingo
7 posts
7 years ago
Fingo's avatar Fingo

Could someone please help me out with the syntax of some of the fluid variables when a grid is being used as one of the “sub-fields” within the fluid?

As an example, the index field - https://docs.expressionengine.com/latest/fieldtypes/fluid.html#index - works fine when using it within a simple field (such as text) but doesn’t seem to work at all within grid fields.

{fluid_field}

    {fluid_field:text}
        {fluid_field:index} {!-- works fine --}
        {content}
    {/fluid_field:text}

    {fluid_field:grid_field}
        {fluid_field:index} {!-- returns nothing --}
        {content}
            <h2>{content:header}</h2>
            {content:copy}
        {/content}
    {/fluid_field:grid_field}
{/fluid_field}

We’ve attempted a few different versions of the syntax but can’t get anything to work - is this a bug or am I just missing something really obvious?

Any suggestions or advice appreciated.

       
JCOGS Design's avatar
JCOGS Design
71 posts
7 years ago
JCOGS Design's avatar JCOGS Design

Fluid fields are very handy, but you cannot mix / match across fluid field instances within a fluid field in the way that you are trying to do.

Each fluid field instance can access just the information stored in that field within the parent fluid field. Attempting to access the extra entry ({fluid_field:index}) within the grid field template definitions won’t work because that value is not defined within the grid field instance you are looking at.

If you want to do what you are trying to do in the template snippet (access one fluid field instance from within another) the only way to do this probably is using Stash to grab the value of {fluid_field:text} when it occurs and then recall it within the bits of the template looking at the grid fields. Or alternatively you maybe can refactor your code to work around this limitation.

HTH

       
JCOGS Design's avatar
JCOGS Design
71 posts
7 years ago
JCOGS Design's avatar JCOGS Design

Fluid fields are very handy, but you cannot mix / match across fluid field instances within a fluid field in the way that you are trying to do.

Each fluid field instance can access just the information stored in that field within the parent fluid field. Attempting to access the extra entry ({fluid_field:index}) within the grid field template definitions won’t work because that value is not defined within the grid field instance you are looking at.

If you want to do what you are trying to do in the template snippet (access one fluid field instance from within another) the only way to do this probably is using Stash to grab the value of {fluid_field:text} when it occurs and then recall it within the bits of the template looking at the grid fields. Or alternatively you maybe can refactor your code to work around this limitation.

HTH

       

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.