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:
@@ -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());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
Reference in New Issue
Block a user