Fieldgroup with custom HTML display values are not re-initialised properly?

1 year 5 months ago - 1 year 5 months ago #66896 by othbert
Hi guys,

I think I've found a bug with the fieldgroup implementation on Flexi 3.1.1

As I mentioned in a previous thread , I created an accordion style element using flexicontent fieldgroup to hold multiple groups of accordion items.

The items may contain a title -> text field, description -> textarea, image -> image, image-size -> radio button.
These are stored in a fieldgroup which is allowed to have multiple values. The fieldgroup is then added with a generic text title and description textarea type field as an accordion 'container'.

The issue I have is that if you have multiple accordion containers on a page, when they are created they appear to re-use a 'global' variable, which contains the previous accordion data and just overwrites the fields that have changed. This works ok for the title, description and radio selection, however it does not work at all for images. Whatever is set for an image will not be overwritten, whether it is empty or full, and whether you try to overwrite with no image, or a different image, it always shows the same image that was originally set for the first accordion on the page.

This happens when you have the display set to custom HTML and using the {{fieldname}} notation to create the output. If I switch it to default HTML then it works fine, but the display naturally is wrong compared to the custom setup I have.
I can see the relevant switching of display in joomla/plugins/flexicontent_fields/fieldgroup/fieldgroup.php starting around line 480 with the calls to getGroupFields and getGroupFieldsValues, but I wanted to check with you first to see if this is a known bug.

I'm not sure if that's an issue with how it is trying to overwrite an image in an image/gallery object as opposed to the others, but either way, should the object not just be created as a new type for display each time with a separate scope and data?

Thanks as always for the great software!

Please Log in or Create an account to join the conversation.

1 year 5 months ago #66898 by micker
can you update to 3.2.0 beta on gihtub and redo your test ?

FLEXIcontent is Free but involves a very big effort on our part.
Like the our support? (for a bug-free FC, despite being huge extension) Like the features? Like the ongoing development and future commitment to FLEXIcontent?
-- Add your voice to the FLEXIcontent JED listing reviews. Thanks![/size]

Please Log in or Create an account to join the conversation.

1 year 5 months ago #66920 by othbert
Hi there,

Updated to 3.2.x-stable branch and the issue still perisists.

Thanks.

Please Log in or Create an account to join the conversation.

1 year 5 months ago #66983 by ggppdk
Hello

test this:
edit field:
plugins/flexicontent_fields/fieldgroup/fieldgroup.php

find line:
if ( isset($grouped_field->{$method}) && is_array($grouped_field->{$method}) ) continue;
and comment it out by adding in front of it 2 slashes:
//


-- FLEXIcontent is Free but involves a big effort on our part.
Like the our support? (for a bug-free FC, despite having a long list of functions) Like the features? Like the ongoing development and future commitment to FLEXIcontent?
-- Add your voice to the FLEXIcontent JED listing with a 5-star review. Thanks!

Please Log in or Create an account to join the conversation.

1 year 5 months ago #66984 by ggppdk
Hello


with not "re-initialized" do you mean "display value properties" of image field

like e.g.:
->"thumbs_src"

that contain the thumbnail url path ?


-- FLEXIcontent is Free but involves a big effort on our part.
Like the our support? (for a bug-free FC, despite having a long list of functions) Like the features? Like the ongoing development and future commitment to FLEXIcontent?
-- Add your voice to the FLEXIcontent JED listing with a 5-star review. Thanks!

Please Log in or Create an account to join the conversation.

1 year 5 months ago #66986 by othbert
Hi there!

ggppdk wrote: Hello

test this:
edit field:
plugins/flexicontent_fields/fieldgroup/fieldgroup.php

find line:

if ( isset($grouped_field->{$method}) && is_array($grouped_field->{$method}) ) continue;
and comment it out by adding in front of it 2 slashes:
//


Commenting the line did not help unfortunately.

ggppdk wrote: Hello

with not "re-initialized" do you mean "display value properties" of image field

like e.g.:
->"thumbs_src"

that contain the thumbnail url path ?


That is indeed what I mean. if I var_dump the $grouped_fields array after calling:
$this->getGroupFieldsValues($field, $item, $grouped_fields, $max_count);
It shows that the public property 'value' has been correctly set to null for the non-existent image in the second accordion, but the display_original, thumbs_src etc paths are still populated from the first accordion.

Thanks, hope that helps?

Please Log in or Create an account to join the conversation.

1 year 5 months ago #66994 by ggppdk

othbert wrote: ...
Thanks, hope that helps?


Yes it does

Please test this:
Replace:
$_name_to_field[$grouped_field->name] = & $grouped_fields[$i];

with:
$_name_to_field[$grouped_field->name] = clone($grouped_fields[$i]);


-- FLEXIcontent is Free but involves a big effort on our part.
Like the our support? (for a bug-free FC, despite having a long list of functions) Like the features? Like the ongoing development and future commitment to FLEXIcontent?
-- Add your voice to the FLEXIcontent JED listing with a 5-star review. Thanks!

Please Log in or Create an account to join the conversation.

1 year 5 months ago #66998 by othbert

ggppdk wrote:
Please test this: ...


This worked perfectly, thanks!

Please Log in or Create an account to join the conversation.

1 year 5 months ago - 1 year 5 months ago #67029 by ggppdk
Hello

ok thanks for feedback
also i have made a more complete fix for next version


-- FLEXIcontent is Free but involves a big effort on our part.
Like the our support? (for a bug-free FC, despite having a long list of functions) Like the features? Like the ongoing development and future commitment to FLEXIcontent?
-- Add your voice to the FLEXIcontent JED listing with a 5-star review. Thanks!

Please Log in or Create an account to join the conversation.

Moderators: vistamediajoomlacornerggppdk
© 2018 Flexicontent. All Rights Reserved.