[4.0] Fix: Saving menu item fails. Call to a member function validate() on bool. Field "show_associations"#23700
[4.0] Fix: Saving menu item fails. Call to a member function validate() on bool. Field "show_associations"#23700ReLater wants to merge 1 commit intojoomla:4.0-devfrom ReLater:patch-2
Conversation
|
I am concerned by one aspect: |
|
I'm also concerned because I don't understand this necessary hardcoding of field names inside models when I read the introduction of pr #12414 of @Hackwar concerning "hardcoded behavior" and "hardcoded filters" . At the moment this pr here and #23501 are just bad "outsourcing of occuring new issues" somehow.
I don't know how similiar behavior can be implemented in the concerning field classes directly or if that's possible anyhow. |
|
I have tested this item ✅ successfully on 23842e3 This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/23700. |
|
@infograf768 you have effectively already hardcoded the usage of that parameter name. If you have issues with the Form changes, then maybe make sure that the associations field doesn't behave in the way it does. |
|
@Hackwar After #12414 , @joomdonation had to do #23501 I had nothing to do with these changes. It is not an association field per se as in the Associations Tab. It looks partly broken for now in 4.0 but this is what it looks like in 3.x |
|
I have tested this item ✅ successfully on 23842e3
|
|
Please do NOT set this as RTC until @Hackwar and @joomdonation give more precise informations on a better way to solve this. |
|
We have two options here:
if (!$fieldObj instanceof FormField)
{
continue;
}To me, #1 would be better. |
As explained above (see screenshot) this is only used for com_content articles in the info_block/ associations layout. |
|
I don't work much with multilingual, so I am unsure. I will try to look at this issue later today to see what's the actual reason of the error and hopefully can come up with a proper fix. |
Tested this and it works fine. |
|
It's certainly wrong to have this code in com_menus. It's a com_content specific parameter. |
|
@joomdonation Unless this change is documented somewhere, option 2 is the proper fix. The form should not fail when |
|
@SharkyKZ I think the field should not belong to the form when association is disabled, so for me, remove the field when it's not needed is better than just ignoring the error. |
|
I think this is a better fix for handling when |

Pull Request for Issue #23696
Related and already merged fix: #23501
Testing Instructions
Install a J4 nightly build of today (Monday, 28 January 2019) or update an older J4 with that package
Go to menu items manager in back-end.
Open
Homemenu item (type "Articles > Featured Articles")Save it.
Error like described in [4.0] current nightly. Saving menu item fails. Call to a member function validate() on bool. Field "show_associations"" #23696 (comment)
Apply patch
Try again to save the menu item.
Should be successful.