You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've encountered problems on a site where I wanted to have a single-language title field on a multi-language template. The reason for this is that the page itself has multilang content but the title is really always only a single language. To make it less abstract: It's my personal website where I want to showcase my modules. So the description is in DE/EN but the title of the page is always single language, like RockPageBuilder or RockMigrations etc...
Today I realised that my page names are not auto-updating on page save, which should be done via a RockMigrations helper that I'm using all over for a long time.
I found out that the issue comes from the title field. The problem is that it has still a multi-lang value in the API but it only has a single-lang UI in the backend:
While I totally understand that from a technical point of view it makes the field useless for the real world.
Actual behavior
The problem is that if a user with lang EN inputs foo the field will show foo for him. But if another user with lang DE edits that page he/she will see value bar that has been input sometime in the past. Now if that DE user changes the field to baz we will have inconsistent values:
EN = foo
DE = baz
Steps to reproduce the issue
On a multilang site and template add the hook to set the title field to useLanguages = false
Make sure your user is using the default language
Enter DEFAULT into the title field and save
Change the user's language to non-default
Enter NON-DEFAULT into the title field and save
Now switch languages in your user's profile and reload the page edit screen - you will see the value of the title field will change from DEFAULT to NON-DEFAULT and vice versa
Possible Solution
I'm not really sure what to do about that and wether that is an issue or not. Technically it might not be an issue, but it would be nice to have a simple solution to just make some fields on a multi-language page single language only. And there - of course - they should always have the same value no matter what language the editor has set in his/her profile.
Setup/Environment
ProcessWire: 3.0.222
PHP: 8.1.16
The text was updated successfully, but these errors were encountered:
The problem is that it has still a multi-lang value in the API but it only has a single-lang UI in the backend:
That's because the field itself is multi-language (via its Fieldtype[Name]Language module), but if you've set $inputfield->useLanguages=false; then multi-language features are disabled for the Inputfield. That's going to create an issue because you've then got a multi-language field with a single-language input. When the $page->title is set to the Inputfield's value attribute, it will be in the user's language, since the string value of a LanguagesPageFieldValue is the value in the user's language.
That useLanguages property is what LanguageSupportFields module uses to enable multi-language on an Inputfield via its own hooks, so you are competing with it by manually changing it with your own hook. I think that's also where a potential solution would be, in the hook you are using. Though to keep it simple, I would probably avoid trying to make a multi-language field behave as non-multi-language and instead use a different single-language field for this purpose. But if you need to use a hook, can you paste in your current hook? Maybe I can suggest things that might enable it to work.
Short description of the issue
This might be related to this issue: #1118
I've encountered problems on a site where I wanted to have a single-language
title
field on a multi-language template. The reason for this is that the page itself has multilang content but the title is really always only a single language. To make it less abstract: It's my personal website where I want to showcase my modules. So the description is in DE/EN but the title of the page is always single language, likeRockPageBuilder
orRockMigrations
etc...I've used Robin's solution mentioned in this thread: https://processwire.com/talk/topic/24431-how-to-disable-multi-language-page-title-for-one-template/?do=findComment&comment=206825
Today I realised that my page names are not auto-updating on page save, which should be done via a RockMigrations helper that I'm using all over for a long time.
I found out that the issue comes from the title field. The problem is that it has still a multi-lang value in the API but it only has a single-lang UI in the backend:
While I totally understand that from a technical point of view it makes the field useless for the real world.
Actual behavior
The problem is that if a user with lang EN inputs
foo
the field will showfoo
for him. But if another user with lang DE edits that page he/she will see valuebar
that has been input sometime in the past. Now if that DE user changes the field tobaz
we will have inconsistent values:Steps to reproduce the issue
useLanguages = false
DEFAULT
into the title field and saveNON-DEFAULT
into the title field and saveDEFAULT
toNON-DEFAULT
and vice versaPossible Solution
I'm not really sure what to do about that and wether that is an issue or not. Technically it might not be an issue, but it would be nice to have a simple solution to just make some fields on a multi-language page single language only. And there - of course - they should always have the same value no matter what language the editor has set in his/her profile.
Setup/Environment
ProcessWire: 3.0.222
PHP: 8.1.16
The text was updated successfully, but these errors were encountered: