-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[com_fields] Multilanguage: correcting custom fields display in function of item language #18474
Conversation
I have tested this item ✅ successfully on 2ae0954 This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/18474. |
A questions.
|
Nope, they are not.
Nope. Specific languages are not subset of All languages. Language ALL exists only for display. In the case of custom fields, their display should depend on the item language itself. |
If this is what you want, it can be done. It will mean that fields will show depending on the active language and no more on the item language. |
exactly, but it is only my opinion, I don't know if this is the right way. |
Please give your opinion here.
|
I think there are arguments for all ways of displaying custom fields, we should be careful and not change behaviour because this can break sites. This needs to be B/C |
Work for me |
I would not filter the fields depending on of the language of this site. The problem is when you edit an article on the front which doesn't belong to the active language, the existing field data get erased of the fields which are not attached to the site language. Was that not the reason why #12656 was made? To have the same field on multiple languages with a translated label? |
@laoneo result: for example in an article tagged to ALL, one could add a bunch of text in French in a custom field tagged to French and it would still show in French when the article is displayed in the site when en-GB is the active language. My first solution may not have been the right one but the second proposal solves precisely that issue. |
Also: |
Also
I tested here by editing a field set to ALL, therefore unrelated to the Active site language, and I have no issue because the content of the field depends on content entered in the article itself. |
So when you edit on the front the article "French Demo" which has the language fr-FR but the site language is set to de-DE. Will then the fields which belong to fr-FR also appear? |
@laoneo |
@laoneo This PR (the original code or the one that I also proposed above) does not change the display or not of the custom field tagged to a specific language or ALL when the item language (article as example) has the same language as the custom field. The issue concerns ONLY an item/article tagged to ALL. |
@laoneo We can't accept displaying in an article tagged to ALL the French tagged custom field when the Active language is English |
If it belongs only for the automatic display events, then I would do the language filtering there. Where you have placed it affects all possible calls like getting them for the form, etc. |
@laoneo
That would display fields tagged to ALL and fields tagged to the active language only when an item is tagged to ALL. EDIT: also make sure $item has a language |
Guess this should work. I'm not so much into the multilanguage stuff as you, but it is the better place to make the language filtering. |
OK. As I guess it is too late for 3.8.2 which is in code freeze, will make a new PR and close this one. |
@laoneo I found out that their display is independent of the display method in they do show (without language filtering, even after my patch which code is added in that method) in registration and site edit profile. Values can be entered for edit profile in frontend, but NOT for a registration where inputs are greyed. Where shall I look for the language filtering for these? Screenshot when editing profile in frontend |
The problem is with users, that it is based on the form and makes some weird stuff here https://github.com/joomla/joomla-cms/blob/staging/components/com_users/views/profile/tmpl/default_custom.php to display the form fields instead of rendering them as every other extension does. Probably here https://github.com/joomla/joomla-cms/blob/staging/components/com_users/models/profile.php#L126 or here https://github.com/joomla/joomla-cms/blob/staging/components/com_users/models/profile.php#L182 you can set the language of the user and then the form should only load the fields with the right language. The fields are probably grayed out because of permissions. |
@laoneo Will look for lang filtering.
Nope. Fields were set to Public. I changed that to Guest and same result. |
@infograf768 if you set Permission of Field to "Allowed" it isn't greyed out anymore: |
Thanks @franz-wohlkoenig mixed permissions and access... @laoneo
this will work for registration as well as profile. |
@infograf768 didn't test it, but you should be able to set the language on the passed data and you should be fine, no need to do such a workaround. |
Indeed, I obtain the correct results if I add in models/profile.php
the problem is that it is OK when editing a profile but does not work for registration... |
I can have a look on the profile issue when the rest is done. Lets try to do it in different steps. |
ok, will do. |
Closing this PR in favor of #18536 |
@@ajejebrazorf01 |
Hello infograf768, exactly this Problem persists on Custom-Fields for User-Registrations-Form: Best Regards |
so this issue it will be included into a new Joomla! update? or should i modify some php files in my Website? |
@infograf768 i am asking again, because i never used github. sorry |
#18743 was closed. It means that the specific code to solve your issue will not be included in Joomla. |
Pull Request for Issue #18396
Issue: An item (article in that case) tagged to ALL languages is displaying all fields tagged to specific languages.
Summary of Changes
When an item is tagged to ALL languages, only display custom fields tagged to ALL languages.
Testing Instructions
Create a multilingual site. 2 Content languages are enough. Here for en-GB and fr-FR
Structure:
===>Categories
===>Articles set as Featured
===> Home menu as Featured Articles menu item for each language.
===> Create some articles custom fields and assign languages, including ALL
For the sake of this demo I added a Media field tagged to ALL and choose the same image for each article.
###Before patch
-----Back-end: when editing an article tagged to ALL languages, we also get the fields tagged to specific languages.
---- Which is also the case in frontend
==> Active language is fr-FR
==>Active language is en-GB
After patch
----- Backend: only fields tagged to ALL languages display in an article tagged to ALL languages.
-----Same in frontend
==> Active language is fr-FR
==>Active language is en-GB
@ajejebrazorf01
@AlexRed
@ggppdk