Issue Hiding "Empty" Group that's Joined

talkinggoat

Member
I have a list left-joined into my main list, with only one group and 4 elements. None of the elements are visible to the public, but the group's name continues to appear, with nothing in it. The group's permissions are public. I have tried setting "Show in form/details" to "Hide if no usable elements".

I don't seem to have this issue, with the non-joined list's groups. Their group permissions are set to public, "Show in form/details" is set to "Yes". The permissions for the elements are set to "Nobody" for "Form (add)" For the non-joined groups, neither the elements or the group show in the public form, when all the permissions for "Form" are set to nobody.. For the joined group, I can set the "Form" permission to nobody in the elements, but the group name always shows. If I set the group to anything other than public, the elements will not populate.
 
Last edited:
@cheesegrits, do you know anything about this? I found the PHP responsible for generating the HTML, "legend"; line 78 in components/com_fabrik/views/form/tmpl/bootstrap/default.php It calls to a property of $group called showLegend, but that's where it completely loses me. I was able to dump all the array properties of $group and the group in question always has showLegend set to 1, even if there is nothing in it. It looks like the line on 78 is testing to see if showLegend contains a true value. For the joined group, it seems to always return 1, or true and will never hide, unless manually hidden by removing the label.

Line 860 of components/com_fabrik/view/form/view.base.php seems to deal with joined groups when it calls to the function getGroup(), if (groupModel->getGroup()->is_join)
 
Last edited:
Hmm.

If I set the elements "Form (add)" access to Nobody, they still show as read only in the new form.

I think I need to understand your setup better, and what you are trying to achieve.

Is you objective to have the group not show in "add" but show in "edit"?

-- hugh
 
@cheesegrits Thanks for responding. I think that's correct, yes. When a new user accesses the form, the group and elements should not show, but the elements should populate. I have several elements that are set to nobody for Form (add) and they populate. For instance, one is a drop-down that will default to "Pending" for volunteer status. That way, when the user fills out the form for the first time, they are set as a "Pending" user. The only difference between this group and the other group (the one that will not hide) is the un-hiding group is a join. Everything works fine with the element, it's the group title, rendered on line 78 of /components/com_fabrik/views/form/tmpl/bootstrap/default.php.

It's my hunch that there is different logic being used to render the group, because it's a join, that does not apply to a normal group - when it is not a join. I am guessing it has something to do with showLegend in the $group array, but I don't know enough about Joomla or PHP, yet, to deconstruct it.

I know the php from line 78 of default.php from above says...

PHP:
        if ($group->showLegend) :?>
            <legend class="legend"><?php echo $group->title;?></legend>
        endif;

I think it is using an "if" statement to execute boolean logic. It's saying that if showLegend is true, render the <legend> HTML. That's why, when I dump the $group array, showLegend = 1, for visible group titles.
 
It goes deeper than just the showLegend thing, that's just a symptom. I think the underlying problem is that in a join, you have those extra id and parent_id fields, which have to be writeable. There's a bug chunk of code under the surface in there which goes through all the elements in the group, figuring out if there's any "usable" ones.

What confuses me is that if you have one which is set to not allow add, but allow edit, it should show anyway, as read-only. So when I try and replicate your setup, with a joined group with two elements in it, set to "Nobody" for "Add" and "Public" for "Edit", they show as read-only fields. But from what you are saying, your don't?

-- hugh
 
I guess I'm baffled, if you're baffled, lol.

I knew there was an underlying function to assign showLegend, I don't know how to track it down, though. It goes through many calls to variables and functions, and I don't know enough about PHP or OOP. I know it's calling to $group and I know $group is an array, but I can't seem to wrap my head around where $group is created. It seems like, whenever I get close to it, it's just a variable name for the output of some other function. I would love to be able to figure this out for you and say, here you go, I found it! :)

Screenshot-from-2019-04-18-19-47-42.png


Screenshot-from-2019-04-18-19-47-36.png
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top