File fields have different default language fallback behavior than pages (multilanguage)

This is more of an informational thread than anything else. I have already created a Github issue (https://github.com/getkirby/kirby/issues/575) for this and was wondering if anybody else has been running into that.

For me, this is quite an urgent bug that needs to be addressed since the only workaround I could come up with so far that doesn’t require touching Kirby core files (effectively my own Kirby fork), involves a site.php with a customized extension to the Kirby class with a custom multilang.php and a complete copy of the multilanguage file.php with one single line changed.

Maybe somebody has a better solution for this…

Your are right, it should actually check if the key exists and the value is an empty string. I labelled it as bug on GitHub and set it to the 2.4.2 milestone, so hopefully it will be in the next release, or soon on the dev branch. Maybe you can create a PR?

1 Like

You are my hero @texnixe :slight_smile:

In case anybody is interested in my workaround; I have put it into a small non-plugin plugin under

The only really relevant change is in the file CustomFile.php which is an exact copy of the multilang File class except for line 42 (happy coincidence ;)) where I replaced the if-statement

if(empty($meta->data[$key]->value)) {

with

if(!isset($meta->data[$key]) || $meta->data[$key]->value == '') {

It’s quite ugly, but it works and I needed a workaround right away…