Skip to content
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

Fix values in shown fields in relations #16570

Open
wants to merge 2 commits into
base: 11.2
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 3 additions & 2 deletions models/DataObject/Service.php
Expand Up @@ -432,11 +432,12 @@ public static function gridObjectData(AbstractObject $object, array $fields = nu
}
}
} else {
$inheritanceBackup = AbstractObject::getGetInheritedValues();
AbstractObject::setGetInheritedValues(true);

$data[$dataKey] = $object->get($key, $user->getLanguage());
$data[$dataKey] = $object->get($key, $user?->getLanguage());

AbstractObject::setGetInheritedValues(false);
AbstractObject::setGetInheritedValues($inheritanceBackup);
Copy link
Contributor

@kingjia90 kingjia90 Apr 23, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

recommending to use useInheritedValues , if that's the same intended change

public static function useInheritedValues(bool $inheritValues, callable $fn, array $fnArgs = []): mixed
{
$backup = DataObject::getGetInheritedValues();
DataObject::setGetInheritedValues($inheritValues);
try {
return $fn(...$fnArgs);
} finally {
DataObject::setGetInheritedValues($backup);
}
}

}
}
}
Expand Down