1
0
mirror of https://github.com/flextype/flextype.git synced 2025-08-11 07:34:22 +02:00

fix(entries): fix wrong Implementation of Slug Field for Entries #452

This commit is contained in:
Awilum
2020-08-11 20:35:59 +03:00
parent 47618093c0
commit cbae6952f3
5 changed files with 5 additions and 5 deletions

View File

@@ -13,7 +13,7 @@ if ($flextype->registry->get('flextype.settings.entries.fields.created_at.enable
$flextype->emitter->addListener('onEntryAfterInitialized', function () use ($flextype) : void {
$flextype->entries->entry['created_at'] = isset($flextype->entries->entry['created_at']) ?
(int) strtotime($flextype->entries->entry['created_at']) :
(int) Filesystem::getTimestamp($flextype->entries->getFileLocation($flextype->entries->entry_path));
(int) Filesystem::getTimestamp($flextype->entries->getFileLocation($flextype->entries->entry_id));
});
$flextype->emitter->addListener('onEntryCreate', function () use ($flextype) : void {

View File

@@ -9,6 +9,6 @@ declare(strict_types=1);
if ($flextype->registry->get('flextype.settings.entries.fields.id.enabled')) {
$flextype->emitter->addListener('onEntryAfterInitialized', function () use ($flextype) : void {
$flextype->entries->entry['id'] = isset($flextype->entries->entry['id']) ? (string) $flextype->entries->entry['id'] : (string) ltrim(rtrim($flextype->entries->entry_path, '/'), '/');
$flextype->entries->entry['id'] = isset($flextype->entries->entry['id']) ? (string) $flextype->entries->entry['id'] : (string) ltrim(rtrim($flextype->entries->entry_id, '/'), '/');
});
}

View File

@@ -11,6 +11,6 @@ use Flextype\Component\Filesystem\Filesystem;
if ($flextype->registry->get('flextype.settings.entries.fields.modified_at.enabled')) {
$flextype->emitter->addListener('onEntryAfterInitialized', function () use ($flextype) : void {
$flextype->entries->entry['modified_at'] = (int) Filesystem::getTimestamp($flextype->entries->getFileLocation($flextype->entries->entry_path));
$flextype->entries->entry['modified_at'] = (int) Filesystem::getTimestamp($flextype->entries->getFileLocation($flextype->entries->entry_id));
});
}

View File

@@ -13,7 +13,7 @@ if ($flextype->registry->get('flextype.settings.entries.fields.published_at.enab
$flextype->emitter->addListener('onEntryAfterInitialized', function () use ($flextype) : void {
$flextype->entries->entry['published_at'] = isset($flextype->entries->entry['published_at']) ?
(int) strtotime($flextype->entries->entry['published_at']) :
(int) Filesystem::getTimestamp($flextype->entries->getFileLocation($flextype->entries->entry_path));
(int) Filesystem::getTimestamp($flextype->entries->getFileLocation($flextype->entries->entry_id));
});
$flextype->emitter->addListener('onEntryCreate', function () use ($flextype) : void {

View File

@@ -9,7 +9,7 @@ declare(strict_types=1);
if ($flextype->registry->get('flextype.settings.entries.fields.slug.enabled')) {
$flextype->emitter->addListener('onEntryAfterInitialized', function () use ($flextype) : void {
$parts = explode('/', ltrim(rtrim($flextype->entries->entry_path, '/'), '/'));
$parts = explode('/', ltrim(rtrim($flextype->entries->entry_id, '/'), '/'));
$flextype->entries->entry['slug'] = isset($flextype->entries->entry['slug']) ? (string) $flextype->entries->entry['slug'] : (string) end($parts);
});
}