1
0
mirror of https://github.com/flextype/flextype.git synced 2025-08-08 14:16:46 +02:00

feat(fields): use Atomastic Filesystem for ModifiedAtField #478

This commit is contained in:
Awilum
2020-10-18 00:26:30 +03:00
parent fec0613b6e
commit 2188d16485

View File

@@ -7,12 +7,10 @@ declare(strict_types=1);
* Founded by Sergey Romanenko and maintained by Flextype Community.
*/
use Flextype\Component\Filesystem\Filesystem;
if (flextype('registry')->get('flextype.settings.entries.fields.modified_at.enabled')) {
flextype('emitter')->addListener('onEntryAfterInitialized', static function (): void {
if (flextype('entries')->getStorage('fetch_single.data.modified_at') == null) {
flextype('entries')->setStorage('fetch_single.data.modified_at', (int) Filesystem::getTimestamp(flextype('entries')->getFileLocation(flextype('entries')->getStorage('fetch_single.id'))));
flextype('entries')->setStorage('fetch_single.data.modified_at', (int) flextype('filesystem')->file(flextype('entries')->getFileLocation(flextype('entries')->getStorage('fetch_single.id')))->lastModified());
}
});
}