mirror of
https://github.com/flextype/flextype.git
synced 2025-08-08 14:16:46 +02:00
feat(fields): remove unused and duplicated media fields #563
This commit is contained in:
@@ -1,34 +0,0 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* Flextype (https://flextype.org)
|
||||
* Founded by Sergey Romanenko and maintained by Flextype Community.
|
||||
*/
|
||||
|
||||
emitter()->addListener('onMediaFetchSingleHasResult', static function (): void {
|
||||
|
||||
if (! registry()->get('flextype.settings.entries.media.fields.created_at.enabled')) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (media()->registry()->get('fetch.data.created_at') === null) {
|
||||
media()->registry()->set('fetch.data.created_at', (int) filesystem()->file(media()->getFileLocation(media()->registry()->get('fetch.id')))->lastModified());
|
||||
} else {
|
||||
media()->registry()->set('fetch.data.created_at', (int) strtotime((string) media()->registry()->get('fetch.data.created_at')));
|
||||
}
|
||||
});
|
||||
|
||||
emitter()->addListener('onMediaCreate', static function (): void {
|
||||
|
||||
if (! registry()->get('flextype.settings.entries.media.fields.created_at.enabled')) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (media()->registry()->get('create.data.created_at') !== null) {
|
||||
return;
|
||||
}
|
||||
|
||||
media()->registry()->set('create.data.created_at', date(registry()->get('flextype.settings.date_format'), time()));
|
||||
});
|
@@ -1,21 +0,0 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* Flextype (https://flextype.org)
|
||||
* Founded by Sergey Romanenko and maintained by Flextype Community.
|
||||
*/
|
||||
|
||||
emitter()->addListener('onMediaCreate', static function (): void {
|
||||
|
||||
if (! registry()->get('flextype.settings.entries.media.fields.created_by.enabled')) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (media()->registry()->get('create.data.created_by') !== null) {
|
||||
return;
|
||||
}
|
||||
|
||||
media()->registry()->set('create.data.created_by', '');
|
||||
});
|
@@ -1,21 +0,0 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* Flextype (https://flextype.org)
|
||||
* Founded by Sergey Romanenko and maintained by Flextype Community.
|
||||
*/
|
||||
|
||||
emitter()->addListener('onMediaFetchSingleHasResult', static function (): void {
|
||||
|
||||
if (! registry()->get('flextype.settings.entries.media.fields.id.enabled')) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (media()->registry()->get('fetch.data.id') !== null) {
|
||||
return;
|
||||
}
|
||||
|
||||
media()->registry()->set('fetch.data.id', strings(media()->registry()->get('fetch.id'))->trimSlashes()->toString());
|
||||
});
|
@@ -1,21 +0,0 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* Flextype (https://flextype.org)
|
||||
* Founded by Sergey Romanenko and maintained by Flextype Community.
|
||||
*/
|
||||
|
||||
emitter()->addListener('onMediaFetchSingleHasResult', static function (): void {
|
||||
|
||||
if (! registry()->get('flextype.settings.entries.media.fields.modified_at.enabled')) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (media()->registry()->get('fetch.data.modified_at') !== null) {
|
||||
return;
|
||||
}
|
||||
|
||||
media()->registry()->set('fetch.data.modified_at', (int) filesystem()->file(media()->getFileLocation(media()->registry()->get('fetch.id')))->lastModified());
|
||||
});
|
@@ -1,23 +0,0 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* Flextype (https://flextype.org)
|
||||
* Founded by Sergey Romanenko and maintained by Flextype Community.
|
||||
*/
|
||||
|
||||
use Ramsey\Uuid\Uuid;
|
||||
|
||||
emitter()->addListener('onMediaCreate', static function (): void {
|
||||
|
||||
if (! registry()->get('flextype.settings.entries.media.fields.uuid.enabled')) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (media()->registry()->get('create.data.uuid') !== null) {
|
||||
return;
|
||||
}
|
||||
|
||||
media()->registry()->set('create.data.uuid', Uuid::uuid4()->toString());
|
||||
});
|
Reference in New Issue
Block a user