From 65a27523a6a1cc89570cfea7767f5585e4a4f9ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niels=20Seelh=C3=B6fer?= Date: Tue, 19 Apr 2022 10:57:07 +0200 Subject: [PATCH 1/4] Added possibility to format dates over typoscript --- Configuration/TypoScript/constants.typoscript | 12 ++--- Configuration/TypoScript/setup.typoscript | 46 ++++++++++--------- .../News/Partials/Media/Type/Application.html | 4 +- .../News/Partials/Media/Type/Audio.html | 4 +- .../News/Partials/Media/Type/Image.html | 4 +- .../News/Partials/Media/Type/Video.html | 4 +- .../Private/News/Templates/News/Detail.html | 10 ++-- .../Private/News/Templates/News/List.html | 9 ++-- ext_emconf.php | 9 ++-- 9 files changed, 54 insertions(+), 48 deletions(-) diff --git a/Configuration/TypoScript/constants.typoscript b/Configuration/TypoScript/constants.typoscript index 3f5bfe3..06c4519 100644 --- a/Configuration/TypoScript/constants.typoscript +++ b/Configuration/TypoScript/constants.typoscript @@ -1,7 +1,7 @@ plugin.tx_news { - view { - templateRootPath = EXT:headless_news/Resources/Private/News/Templates/ - partialRootPath = EXT:headless_news/Resources/Private/News/Partials/ - layoutRootPath = EXT:headless_news/Resources/Private/News/Layouts/ - } -} \ No newline at end of file + view { + templateRootPath = EXT:headless_news/Resources/Private/News/Templates/ + partialRootPath = EXT:headless_news/Resources/Private/News/Partials/ + layoutRootPath = EXT:headless_news/Resources/Private/News/Layouts/ + } +} diff --git a/Configuration/TypoScript/setup.typoscript b/Configuration/TypoScript/setup.typoscript index f584985..11acbf8 100644 --- a/Configuration/TypoScript/setup.typoscript +++ b/Configuration/TypoScript/setup.typoscript @@ -1,27 +1,31 @@ tt_content.list =< lib.contentElementWithHeader tt_content.list { - fields { - content { - fields { - data = CASE - data { - key.field = list_type + fields { + content { + fields { + data = CASE + data { + key.field = list_type - news_pi1 = USER - news_pi1 { - userFunc = TYPO3\CMS\Extbase\Core\Bootstrap->run - vendorName = GeorgRinger - extensionName = News - pluginName = Pi1 - controller = News - - view < plugin.tx_news.view - persistence < plugin.tx_news.persistence - settings < plugin.tx_news.settings - } - } + news_pi1 = USER + news_pi1 { + userFunc = TYPO3\CMS\Extbase\Core\Bootstrap->run + vendorName = GeorgRinger + extensionName = News + pluginName = Pi1 + controller = News + view < plugin.tx_news.view + persistence < plugin.tx_news.persistence + settings < plugin.tx_news.settings + settings { + dateFormat = TEXT + dateFormat = M d Y + dateTimeFormat = TEXT + dateTimeFormat = Y-m-d H:i:s } - + } } + } } -} \ No newline at end of file + } +} diff --git a/Resources/Private/News/Partials/Media/Type/Application.html b/Resources/Private/News/Partials/Media/Type/Application.html index 4c56c08..93e9a97 100644 --- a/Resources/Private/News/Partials/Media/Type/Application.html +++ b/Resources/Private/News/Partials/Media/Type/Application.html @@ -11,8 +11,8 @@ description: file.description, mimetype: file.mimetype, publicUrl: '{f:uri.typolink(parameter: file.publicUrl, absolute: absolute)}', - creationTime: '{f:if(condition: file.creationTime, then: \'{file.creationTime -> f:format.date(format: \\\'Y-m-d\ H:i:s\\\')}\')}', - modificationTime: '{f:if(condition: file.modificationTime, then: \'{file.modificationTime -> f:format.date(format: \\\'Y-m-d\ H:i:s\\\')}\')}' + creationTime: '{f:if(condition: file.creationTime, then: \'{file.creationTime -> f:format.date(format: settings.dateTimeFormat)}\')}', + modificationTime: '{f:if(condition: file.modificationTime, then: \'{file.modificationTime -> f:format.date(format: settings.dateTimeFormat)}\')}' } }"/> diff --git a/Resources/Private/News/Partials/Media/Type/Audio.html b/Resources/Private/News/Partials/Media/Type/Audio.html index 4ebafc2..866422e 100644 --- a/Resources/Private/News/Partials/Media/Type/Audio.html +++ b/Resources/Private/News/Partials/Media/Type/Audio.html @@ -26,8 +26,8 @@ mimetype: audio.mimetype, source: '{f:uri.typolink(parameter: audio.publicUrl, absolute: absolute)}', autoplay: '{autoplay -> headless:format.json.decode()}', - creationTime: '{f:if(condition: audio.creationTime, then: \'{audio.creationTime -> f:format.date(format: \\\'Y-m-d\ H:i:s\\\')}\')}', - modificationTime: '{f:if(condition: audio.modificationTime, then: \'{audio.modificationTime -> f:format.date(format: \\\'Y-m-d\ H:i:s\\\')}\')}' + creationTime: '{f:if(condition: audio.creationTime, then: \'{audio.creationTime -> f:format.date(format: settings.dateTimeFormat)}\')}', + modificationTime: '{f:if(condition: audio.modificationTime, then: \'{audio.modificationTime -> f:format.date(format: settings.dateTimeFormat)}\')}' }}"/> diff --git a/Resources/Private/News/Partials/Media/Type/Image.html b/Resources/Private/News/Partials/Media/Type/Image.html index 45b2dd7..6919637 100644 --- a/Resources/Private/News/Partials/Media/Type/Image.html +++ b/Resources/Private/News/Partials/Media/Type/Image.html @@ -64,8 +64,8 @@ link: '{f:uri.typolink(parameter: image.link)}', mimetype: image.originalResource.mimetype, showInPreview: image.showinpreview, - creationTime: '{f:if(condition: image.originalResource.creationTime, then: \'{image.originalResource.creationTime -> f:format.date(format: \\\'Y-m-d\ H:i:s\\\')}\')}', - modificationTime: '{f:if(condition: image.originalResource.modificationTime, then: \'{image.originalResource.modificationTime -> f:format.date(format: \\\'Y-m-d\ H:i:s\\\')}\')}' + creationTime: '{f:if(condition: image.originalResource.creationTime, then: \'{image.originalResource.creationTime -> f:format.date(format: settings.dateTimeFormat)}\')}', + modificationTime: '{f:if(condition: image.originalResource.modificationTime, then: \'{image.originalResource.modificationTime -> f:format.date(format: settings.dateTimeFormat)}\')}' }, images: { defaultImage: { diff --git a/Resources/Private/News/Partials/Media/Type/Video.html b/Resources/Private/News/Partials/Media/Type/Video.html index 5de1184..d868152 100644 --- a/Resources/Private/News/Partials/Media/Type/Video.html +++ b/Resources/Private/News/Partials/Media/Type/Video.html @@ -26,8 +26,8 @@ mimetype: video.mimetype, source: '{f:if(condition: \'{video.extension} == \\\'youtube\\\' || {video.extension} == \\\'vimeo\\\'\', then: video.publicUrl, else: \'{f:uri.typolink(parameter: video.publicUrl, absolute: absolute)}\')}', autoplay: '{autoplay -> headless:format.json.decode()}', - creationTime: '{f:if(condition: video.creationTime, then: \'{video.creationTime -> f:format.date(format: \\\'Y-m-d\TH:i:sP\\\')}\')}', - modificationTime: '{f:if(condition: video.modificationTime, then: \'{video.modificationTime -> f:format.date(format: \\\'Y-m-d\TH:i:sP\\\')}\')}' + creationTime: '{f:if(condition: video.creationTime, then: \'{video.creationTime -> f:format.date(format: settings.dateTimeFormat')}\')}', + modificationTime: '{f:if(condition: video.modificationTime, then: \'{video.modificationTime -> f:format.date(format: \settings.dateTimeFormat)}\')}' }}" /> diff --git a/Resources/Private/News/Templates/News/Detail.html b/Resources/Private/News/Templates/News/Detail.html index 35bd409..8c77c8f 100644 --- a/Resources/Private/News/Templates/News/Detail.html +++ b/Resources/Private/News/Templates/News/Detail.html @@ -15,10 +15,10 @@ teaser: newsItem.teaser, isTopNews: newsItem.istopnews, bodytext: '{newsItem.bodytext -> f:format.html(parseFuncTSPath: \'lib.parseFunc_links\')}', - crdate: '{f:if(condition: newsItem.crdate, then: \'{newsItem.crdate -> f:format.date(format: \\\'M\ d\ Y\\\')}\')}', - tstamp: '{f:if(condition: newsItem.tstamp, then: \'{newsItem.tstamp -> f:format.date(format: \\\'M\ d\ Y\\\')}\')}', - datetime: '{f:if(condition: newsItem.datetime, then: \'{newsItem.datetime -> f:format.date(format: \\\'M\ d\ Y\\\')}\')}', - archive: '{f:if(condition: newsItem.archive, then: \'{newsItem.archive -> f:format.date(format: \\\'M\ d\ Y\\\')}\')}', + crdate: '{f:if(condition: newsItem.crdate, then: \'{newsItem.crdate -> f:format.date(format: settings.dateFormat)}\')}', + tstamp: '{f:if(condition: newsItem.tstamp, then: \'{newsItem.tstamp -> f:format.date(format: settings.dateFormat)}\')}', + datetime: '{f:if(condition: newsItem.datetime, then: \'{newsItem.datetime -> f:format.date(format: settings.dateFormat)}\')}', + archive: '{f:if(condition: newsItem.archive, then: \'{newsItem.archive -> f:format.date(format: settings.dateFormat)}\')}', author: { author: newsItem.author, authorEmail: newsItem.authorEmail @@ -42,4 +42,4 @@ contentElements: '{f:render(partial: \'ContentElements\', arguments: \'{contentElementIdList: newsItem.contentElementIdList}\') -> headless:format.json.decode()}' }"/> - \ No newline at end of file + diff --git a/Resources/Private/News/Templates/News/List.html b/Resources/Private/News/Templates/News/List.html index c94b940..750d9a7 100644 --- a/Resources/Private/News/Templates/News/List.html +++ b/Resources/Private/News/Templates/News/List.html @@ -1,4 +1,5 @@ + @@ -60,10 +61,10 @@ title: newsItem.title, teaser: newsItem.teaser, isTopNews: newsItem.istopnews, - crdate: '{f:if(condition: newsItem.crdate, then: \'{newsItem.crdate -> f:format.date(format: \\\'M\ d\ Y\\\')}\')}', - tstamp: '{f:if(condition: newsItem.tstamp, then: \'{newsItem.tstamp -> f:format.date(format: \\\'M\ d\ Y\\\')}\')}', - datetime: '{f:if(condition: newsItem.datetime, then: \'{newsItem.datetime -> f:format.date(format: \\\'M\ d\ Y\\\')}\')}', - archive: '{f:if(condition: newsItem.archive, then: \'{newsItem.archive -> f:format.date(format: \\\'Y-m-d\ H:i:s\\\')}\')}', + crdate: '{f:if(condition: newsItem.crdate, then: \'{newsItem.crdate -> f:format.date(format: settings.dateFormat)}\')}', + tstamp: '{f:if(condition: newsItem.tstamp, then: \'{newsItem.tstamp -> f:format.date(format: settings.dateFormat)}\')}', + datetime: '{f:if(condition: newsItem.datetime, then: \'{newsItem.datetime -> f:format.date(format: settings.dateFormat)}\')}', + archive: '{f:if(condition: newsItem.archive, then: \'{newsItem.archive -> f:format.date(format: settings.dateTimeFormat)}\')}', author: { author: newsItem.author, authorEmail: newsItem.authorEmail diff --git a/ext_emconf.php b/ext_emconf.php index 9613d24..ba8f1cc 100644 --- a/ext_emconf.php +++ b/ext_emconf.php @@ -1,5 +1,6 @@ 'Headless News', 'description' => 'This extension provides integration with news to output content from TYPO3 in JSON format.', @@ -11,12 +12,12 @@ 'version' => '1.0.1', 'constraints' => [ 'depends' => [ - 'typo3' => '9.5.0-10.0.99', - 'frontend' => '9.5.0-10.0.99' + 'typo3' => '9.5.0-11.5.99', + 'frontend' => '9.5.0-11.5.99', ], 'conflicts' => [], 'suggests' => [ - 'headless' => '2.0.0-2.9.9' - ] + 'headless' => '2.0.0-3.9.9', + ], ], ]; From 1fbb76d9c4dc7e0ab90f45c077bcd776fddc4e74 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niels=20Seelh=C3=B6fer?= Date: Tue, 19 Apr 2022 11:13:10 +0200 Subject: [PATCH 2/4] No absolute URL --- Resources/Private/News/Partials/List/Pagination.html | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Resources/Private/News/Partials/List/Pagination.html b/Resources/Private/News/Partials/List/Pagination.html index 1d5358d..fd20fa3 100644 --- a/Resources/Private/News/Partials/List/Pagination.html +++ b/Resources/Private/News/Partials/List/Pagination.html @@ -5,19 +5,19 @@ + value="{f:uri.action(action:actionName, arguments:{currentPage: pagination.previousPageNumber}, addQueryString:1)}"/> + value="{f:uri.action(action:actionName, arguments:{currentPage: pagination.nextPageNumber}, addQueryString:1)}"/> {f:if(condition: iterator.isLast, else: ',')} @@ -40,4 +40,4 @@ ] - \ No newline at end of file + From 9e9c69cc38028a2f832f6a03d30abc9e4b4c763d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niels=20Seelh=C3=B6fer?= Date: Tue, 19 Apr 2022 11:34:54 +0200 Subject: [PATCH 3/4] No absolute URL --- Resources/Private/News/Partials/List/Pagination.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Resources/Private/News/Partials/List/Pagination.html b/Resources/Private/News/Partials/List/Pagination.html index fd20fa3..af916dd 100644 --- a/Resources/Private/News/Partials/List/Pagination.html +++ b/Resources/Private/News/Partials/List/Pagination.html @@ -32,7 +32,7 @@ {f:if(condition: iterator.isLast, else: ',')} From d2d10a42a527369f77daa31981689a6b5f464aea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niels=20Seelh=C3=B6fer?= Date: Fri, 22 Apr 2022 12:25:08 +0200 Subject: [PATCH 4/4] versions in emconf added more + backlink in JSON-Response for list- and detail-view --- Resources/Private/News/Templates/News/Detail.html | 3 ++- Resources/Private/News/Templates/News/List.html | 3 ++- composer.json | 2 +- ext_emconf.php | 4 ++-- 4 files changed, 7 insertions(+), 5 deletions(-) diff --git a/Resources/Private/News/Templates/News/Detail.html b/Resources/Private/News/Templates/News/Detail.html index 8c77c8f..d551f9a 100644 --- a/Resources/Private/News/Templates/News/Detail.html +++ b/Resources/Private/News/Templates/News/Detail.html @@ -33,7 +33,8 @@ alternativeTitle: newsItem.alternativeTitle }, pathSegment: newsItem.pathSegment, - canonical: '{f:uri.page(pageUid: newsItem.canonical, additionalParams: \'{tx_news_pi1: \\\'{news: newsItem.uid, action: \\\\\\\'detail\\\\\\\', controller: \\\\\\\'News\\\\\\\'}\\\'}\')}' + canonical: '{f:uri.page(pageUid: newsItem.canonical, additionalParams: \'{tx_news_pi1: \\\'{news: newsItem.uid, action: \\\\\\\'detail\\\\\\\', controller: \\\\\\\'News\\\\\\\'}\\\'}\')}', + backLink: '{f:translate(key: \'back-link\', extensionName: \'news\')}' }, settings: { templateLayout: settings.templateLayout, diff --git a/Resources/Private/News/Templates/News/List.html b/Resources/Private/News/Templates/News/List.html index 750d9a7..62cc4dd 100644 --- a/Resources/Private/News/Templates/News/List.html +++ b/Resources/Private/News/Templates/News/List.html @@ -79,7 +79,8 @@ alternativeTitle: newsItem.alternativeTitle }, slug: '{n:link(newsItem: newsItem, settings: settings, uriOnly: 1)}', - pathSegment: newsItem.pathSegment + pathSegment: newsItem.pathSegment, + moreLink: '{f:translate(key: \'more-link\', extensionName: \'news\')}' }"/> diff --git a/composer.json b/composer.json index 3f2c51a..bd818b7 100644 --- a/composer.json +++ b/composer.json @@ -31,7 +31,7 @@ "typo3/cms-core": "^10.0 || ^11.5" }, "suggest": { - "friendsoftypo3/headless": "^2.0", + "friendsoftypo3/headless": "^2.0 || ^3.0", "georgringer/news": "^9.0" }, "extra": { diff --git a/ext_emconf.php b/ext_emconf.php index ba8f1cc..06652c1 100644 --- a/ext_emconf.php +++ b/ext_emconf.php @@ -12,8 +12,8 @@ 'version' => '1.0.1', 'constraints' => [ 'depends' => [ - 'typo3' => '9.5.0-11.5.99', - 'frontend' => '9.5.0-11.5.99', + 'typo3' => '10.0.0-11.5.99', + 'frontend' => '10.0.0-11.5.99', ], 'conflicts' => [], 'suggests' => [