Bug #23606 Bug Fixed

Fluid variables do not output if inside a subfield using a {content}{/content} tag pair

Version: 4.2.1 Reporter: Rick Lecoat

I am seeing different behaviour regarding the output of fluid field variables when used inside a sub-field, depending upon whether that sub-field has a single ‘content’ tag or whether it uses a tag pair. Eg, in the following:

{my_fluid_field}
    {my_fluid_field:sub_field}
      {my_fluid_field:current_field_name}
     {content}
    {/my_fluid_field:sub_field}
{/my_fluid_field}

The current_field_name variable correctly outputs the name of the subfield that it is in. But in this:

{my_fluid_field}
    {my_fluid_field:sub_field}
      {my_fluid_field:current_field_name}
     {content}{/content}
    {/my_fluid_field:sub_field}
{/my_fluid_field}

It does not.

Is this a bug? I guess I might be using the variable tags in the wrong way — to be honest the docs are bit thin in this area and knowing quite how to structure the syntax is not entirely obvious — but the above issue does seem like it might be a bug. (If it’s not, though, could somebody maybe bulk-up the documentation to make it a little clearer how those variables should be used? I received various pieces of helpful of advice on that from the Slack channel, but it often contradicted other people’s advice or the docs themselves, and nobody seemed to be 100% certain).

  • Hey Rick, thanks for the report. We actually caught this issue internally a bit ago and have a fix in for next release. I’ve added a patch to the Solution tab that you can apply if you like.

    Derek Jones
    15th May, 2018 at 11:27am
  • Thanks Derek. Applying the path fixes the issue it was intended to fix, but seems to create a new one, namely: conditionals that check for populated content inside of a {content} tag pair (eg. a column of a grid field inside a fluid field) seem to fail. Example: in the following, subfield is a grid with three columns, one of which is named ‘caption’.

    {my_fluid_field}
     {my_fluid_field:subfield}
      {content}
       {if content:caption}<span>{content:caption}</span>{/if}
      {/content}
     {/my_fluid_field:subfield}
    {/my_fluid_field}

    I’ve just run some tests, swapping the pre-patch and post-patch version of the tag.php file (from your posted solution) in and out, and each time the caption appears in my markup when using the pre-patched file, and does not when using the post-patch file.

    Rick Lecoat
    18th May, 2018 at 7:18am
  • Typo: my last comment should have started: “Applying the patch…” Sorry about that.

    Rick Lecoat
    18th May, 2018 at 7:20am
  • I’ll start a new bug report for this.

    Rick Lecoat
    20th May, 2018 at 4:48pm

You must be signed in to comment on a bug report.

  • On line 140 of system/ee/EllisLab/Addons/fluid_field/Service/Tag.php change:

    $tagdata = $this->parsePairs($field);

    to:

    $tagdata = $this->parsePairs($field, $tagdata);

    On line 152 update the parsePairs method signature and remove the first line of code:

    protected function parsePairs(FieldFacade $field)
    {
        $tagdata = $this->getTagdata();

    like so:

    protected function parsePairs(FieldFacade $field, $tagdata)
    {
.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases