Install a multilingual site (English & French).
Edit an article that has language All and change it to English.
Click Associations button.
View PHP error log.
PHP Notice: Undefined index: associations in \libraries\src\MVC\Model\AdminModel.php on line 1713
Labels |
Added:
?
|
About my Note above:
someone has added in the edit.php for all components an $hasAssoc
variable which prevents displaying the Notice in the Associations Tab. GRRR...
With PR #27023 applied, the following alert is displayed. No notice in PHP error log when clicking the Associations
button. Please confirm to close this issue.
The language has been changed. If you save this item again it will reset the available associations. If this was not intended, close the item.
Status | New | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2019-11-09 06:20:39 |
Closed_By | ⇒ | infograf768 |
Weird but true. ;) Closing.
The Notice displays if we have only 2 languages.
The Associations button is the Toolbar button, not the Associations tab. It loads the side-by-side com_associations page.
The issue comes from the fact that the article is temporarily considered as set to ALL languages when getting to com_associations side-by-side because the article has not been saved yet to English.
Once displayed in the side-by-side its language is correctly set as the article is automatically saved in the method.
Let's go a bit further into this.
If the article (saved) is set to All languages and we click on the Associations Toolbar, we correctly get a Notice.
It comes from the string
JGLOBAL_ASSOC_NOT_POSSIBLE="To define associations, please make sure the item language is not set to 'All'."
We do have another string that should be used if the language is modified from All languages to English without saving first when clicking on the Associations Toolbar button. It is:
JGLOBAL_ASSOCIATIONS_NEW_ITEM_WARNING="To create associations, first save the item."
But this error would only be displayed if it's a new article (
$id == 0
).The solution is to force that message to displayed.
But we must be aware that when message is displayed, the article has already been saved and therefore is already set to English.
Therefore, to get rid of the Notice the modified code would be
We also could create a new Message.
Something like:
"The item language has now been saved. Please try again."
I can make the PR. What you think?
Note:
We have also an issue with the Associations Tab where a message should display when the language is set to All. Independant from this one.