Fixed sorting by groups in Flex Users

This commit is contained in:
Matias Griese
2020-11-09 20:44:37 +02:00
parent d3f1f833ab
commit b50dbf3ff0
2 changed files with 6 additions and 2 deletions

View File

@@ -21,6 +21,7 @@
* Fixed bug in collections where filter `type: false` did not work
* Fixed `print_r()` in twig
* Fixed sorting by groups in `Flex Users`
* Changing `Flex Page` template causes the other language versions of that page to lose their content [admin#1958](https://github.com/getgrav/grav-plugin-admin/issues/1958)
# v1.7.0-rc.17
## 10/07/2020

View File

@@ -55,8 +55,11 @@ trait PageTranslateTrait
} elseif ('' === $code) {
$object = $this->getLanguage() ? $this->getFlexDirectory()->getObject($this->getMasterKey(), 'storage_key') : $this;
} else {
$key = $this->getStorageKey() . '|.' . $code;
$meta = ['storage_key' => $key, 'lang' => $code] + $this->getMetaData();
$meta = $this->getMetaData();
$meta['template'] = $this->getLanguageTemplates()[$code] ?? $meta['template'];
$key = $this->getStorageKey() . '|' . $meta['template'] . '.' . $code;
$meta['storage_key'] = $key;
$meta['lang'] = $code;
$object = $this->getFlexDirectory()->loadObjects([$key => $meta])[$key] ?? null;
}