Language independent fields in blueprints

Lately here were some posts that have to do with the fact that in multi-language websites there are several content files each web page. This is right and ok.

But such pages have also cross-language fields, such as links on own pictures, prices, dates and suchlike, which must have the same value in all languages.

In order to solve this problem of cross-language fields in the panel, I propose to introduce a new parameter, e.g. “language independent”, for fields in blueprint files.
In these can then be determined the language, in which the respective entry for all languages is stored from the panel.
I do not want to take the default language for this, the default language of a website may be changed later…
When such a field is retrieved from a template or a snippet or the panel, the value of the field from the language specified in the blueprint should be determined automatically across all languages.

I know of @texnixe (Add $field->label to get the label of a panel field) that this in Kirby does not exist and may be difficult to implement.

Therefore, I could also imagine that for the panel an artificial language, e.g. “nal” (“not a language”), is implemented firmly, where in such a case automatically all the values of the cross-language fields are stored.
When such a field is retrieved from a template or a snippet or the panel, the value of the field from the language “nal” should be determined automatically across all languages. Thus, these fields are no longer stored in the normal language content files.
For such a field the new parameter, e.g. “language independent”, in the blueprint should be set to true, the default value should be false.

1 Like

I just had an idea today for my recent client’s work where I need exactly this – I didn’t work on this yet, and didn’t read enough to say if it’s gonna work or not, but I think it should be possible with the use of hooks, shouldn’t it? So here is my planned workflow as a custom plugin:

At some point – I thought about a plugins’ config – the fields which should be language independent are defined, through the fieldtype, the name or something else. Then the hook panel.page.update looks if there are matching fields and updates all language files with the same value you just entered – so no matter in which language you are, you have always the same values on all languages.

Any comments, hints or some problems I missed? As I said, I didn’t test this idea, but I will as soon as I can… Hope to have a working solution next time I can post :wink:

1 Like

Yes, I think that 's the way to go for the moment. Haven’t tested it but I can imagine that it could work.

I think having such language independent fields in all .txt field instead of one of a specific language and sync them is better (like @jakobploens plans) then the information won’t be lost if a file/language is deleted … at the moment using hooks sounds good, but in future a blueprint option as suggested by @anon77445132 to actives this syncing would be great.