Skip to content

Commit

Permalink
[TASK] Compatible with Typo3 V12 (#28)
Browse files Browse the repository at this point in the history
  • Loading branch information
nitsan-technologies authored Oct 10, 2023
1 parent 2b16367 commit b66277e
Show file tree
Hide file tree
Showing 8 changed files with 135 additions and 17 deletions.
21 changes: 15 additions & 6 deletions Configuration/TCA/Overrides/sys_template.php
Original file line number Diff line number Diff line change
@@ -1,13 +1,22 @@
<?php
defined('TYPO3_MODE') || die();
defined('TYPO3') || die();

call_user_func(function () {
/**
* Default TypoScript for Headless News
*/
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addStaticFile(
'headless_news',
'Configuration/TypoScript',
'Headless News'
);
$versionInformation = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Core\Information\Typo3Version::class);
if ($versionInformation->getMajorVersion() > 11) {
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addStaticFile(
'headless_news',
'Configuration/TypoScript/v12',
'Headless News For V12'
);
} else {
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addStaticFile(
'headless_news',
'Configuration/TypoScript',
'Headless News'
);
}
});
7 changes: 7 additions & 0 deletions Configuration/TypoScript/v12/constants.typoscript
Original file line number Diff line number Diff line change
@@ -0,0 +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/
}
}
100 changes: 100 additions & 0 deletions Configuration/TypoScript/v12/setup.typoscript
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
tt_content.news_pi1 =< lib.contentElementWithHeader
tt_content.news_pi1 {
fields {
content {
fields {
data = USER
data {
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
}
}
}
}
}
}

tt_content.news_newsliststicky < tt_content.news_pi1
tt_content.news_newsliststicky {
fields {
content {
fields {
data = USER
data {
pluginName = NewsListSticky
}
}
}
}
}

tt_content.news_newsdatemenu < tt_content.news_pi1

tt_content.news_newssearchresult < tt_content.news_pi1
tt_content.news_newssearchresult {
fields {
content {
fields {
data = USER
data {
pluginName = NewsSearchForm
}
}
}
}
}

tt_content.news_categorylist < tt_content.news_pi1
tt_content.news_categorylist {
fields {
content {
fields {
data = USER
data {
pluginName = CategoryList
controller = Category
}
}
}
}
}

tt_content.news_taglist < tt_content.news_pi1
tt_content.news_taglist {
fields {
content {
fields {
data = USER
data {
pluginName = TagList
controller = Tag
}
}
}
}
}

tt_content.news_newsdetail < tt_content.news_pi1
tt_content.news_newsdetail {
fields {
content {
fields {
data = USER
data {
pluginName = NewsDetail
}
}
}
}
}
2 changes: 1 addition & 1 deletion Resources/Private/News/Partials/Files.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<f:format.raw>
[
<f:for each="{files}" as="file" iteration="iterator">
<f:if condition="{file.showinpreview} == 0 && {0: view} == {0: 'detail'} || {file.showinpreview} == 1 || {file.showinpreview} == 2 && {0: view} == {0: 'list'} || {0: type} == {0: 'relatedFiles'}">
<f:if condition="{file.showinpreview} == 0 && {0: view} == {0: 'detail'} || {file.showinpreview} == 1 || {file.showinpreview} == 2 && {0: view} == {0: 'list'} || {0: type} == {0: 'relatedFiles'} || {0: type} == {0: 'media'}">
{f:if(condition: imageSet, then: ',')}
<f:render section="File" arguments="{file: file, view: view}"/>
<f:variable name="imageSet" value="1"/>
Expand Down
8 changes: 5 additions & 3 deletions Resources/Private/News/Templates/News/List.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@
orderBy: settings.orderBy,
orderDirection: settings.orderDirection,
templateLayout: settings.templateLayout,
action: 'list'
action: 'list',
cropMaxCharacters: settings.cropMaxCharacters
}"/>
</f:format.raw>
}
Expand All @@ -46,7 +47,8 @@
orderBy: settings.orderBy,
orderDirection: settings.orderDirection,
templateLayout: settings.templateLayout,
action: 'list'
action: 'list',
cropMaxCharacters: settings.cropMaxCharacters
}"/>
</f:format.raw>
}
Expand All @@ -69,7 +71,7 @@
author: newsItem.author,
authorEmail: newsItem.authorEmail
},
media: '{f:render(partial: \'Files\', arguments: \'{files: newsItem.media, view: \\\'list\\\', type: \\\'media\\\'}\') -> headless:format.json.decode()}',
media: '{f:render(partial: \'Files\', arguments: \'{files: newsItem.falMedia, view: \\\'list\\\', type: \\\'media\\\'}\') -> headless:format.json.decode()}',
falRelatedFiles: '{f:render(partial: \'Files\', arguments: \'{files: newsItem.falRelatedFiles, view: \\\'list\\\', type: \\\'relatedFiles\\\'}\') -> headless:format.json.decode()}',
categories: '{f:render(partial: \'Categories\', arguments: \'{categories: newsItem.categories}\') -> headless:format.json.decode()}',
tags: '{f:render(partial: \'Tags\', arguments: \'{tags: newsItem.tags}\') -> headless:format.json.decode()}',
Expand Down
2 changes: 1 addition & 1 deletion Resources/Private/News/Templates/Vue/CeNews_pi1.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
</div>
</template>
<script>
import baseCe from "~typo3/mixins/component/baseCe";
import baseCe from "~typo3/components/content/mixins/baseCe";
import NewsList from "./Components/NewsList";
import NewsSingle from "./Components/NewsSingle";
Expand Down
6 changes: 3 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@
}
],
"require": {
"typo3/cms-core": "^10.0 || ^11.5"
"typo3/cms-core": "^10.0 || ^12.0"
},
"suggest": {
"friendsoftypo3/headless": "^2.0 || ^3.0",
"georgringer/news": "^9.0"
"friendsoftypo3/headless": "^2.0 || ^4.0",
"georgringer/news": "^9.0 || ^11.0"
},
"extra": {
"typo3/cms": {
Expand Down
6 changes: 3 additions & 3 deletions ext_emconf.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@
'version' => '2.0.0',
'constraints' => [
'depends' => [
'typo3' => '10.0.0-11.5.99',
'frontend' => '10.0.0-11.5.99',
'typo3' => '10.0.0-12.5.99',
'frontend' => '10.0.0-12.5.99',
],
'conflicts' => [],
'suggests' => [
'headless' => '2.0.0-3.9.9',
'headless' => '2.0.0-4.9.9',
],
],
];

0 comments on commit b66277e

Please sign in to comment.