By Laetitia BATTESTI on Friday, 11 June 2021
Posted in Feature Requests
Replies 4
Likes 0
Views 6.8K
Votes 0
Hello, thank you for the great job. Within an 'articles by category module' I would like to hide/show the custom fields (product description) when the user click on a "details' button. can easy layouts do that
This could be done with a UIkit toggle or Bootstrap collapse (see https://getuikit.com/docs/toggle or https://getbootstrap.com/docs/3.3/javascript/#collapse).

If you have difficulties let me know and I'll try to assist you
·
3 years ago
·
0 Likes
·
0 Votes
·
0 Comments
·
Hello, thank you jor the answer.
As I am displaying an "articles by category blog" the collapse method works fine with a "details" link for the first article but if the same link appears on the other articles, it opens the custom field layouts in the same first article.
I want the same behavior for each article displayed,of course.
I send images EasyLayouts1.png
EasyLayouts2.png
EasyLayouts3.png

Thank you for your help, best regards
·
3 years ago
·
0 Likes
·
0 Votes
·
0 Comments
·
You need a unique ID in the layout.

So where you have collapseExample you would need to incorporate an item id in some way. This isn't currently possible in EasyLayouts - I'll take a look as see what is possible.
·
3 years ago
·
0 Likes
·
0 Votes
·
0 Comments
·
Ok - not so hard

Edit the file administrator/components/com_easylayouts/output/common/custom_field.php and add these new lines

foreach (array("subform_wrappertop", "subform_wrappertop") as $wrapperfield)
{
$field[$wrapperfield] = str_replace("{ID}", isset($item->id) ? $item->id : "", $field[$wrapperfield]);
}


at line 34 just after


$field["subform_wrappertop"] = str_replace('{FIELDNAME}', $heading, $field["subform_wrappertop"]);
$field["subform_wrapperbottom"] = str_replace('{FIELDNAME}', $heading, $field["subform_wrapperbottom"]);



Then change your wrapper HTML use use


collapseExample{ID}



I'll include this change in the next release of EasyLayouts
·
3 years ago
·
0 Likes
·
0 Votes
·
0 Comments
·
View Full Post