Skip to content
Snippets Groups Projects
Verified Commit 3baf0c24 authored by Kevin Ditscheid's avatar Kevin Ditscheid
Browse files

[TASK] Add field for disabling comments

parent a34e9b77
No related branches found
No related tags found
1 merge request!42Feature disable comments per page
...@@ -97,6 +97,11 @@ class News extends CategoryAndNews { ...@@ -97,6 +97,11 @@ class News extends CategoryAndNews {
*/ */
protected $contentFromAnotherPage = 0; protected $contentFromAnotherPage = 0;
/**
* @var bool
*/
protected $enableComments = TRUE;
/** /**
* Constructor * Constructor
*/ */
...@@ -383,4 +388,18 @@ class News extends CategoryAndNews { ...@@ -383,4 +388,18 @@ class News extends CategoryAndNews {
public function setContentFromAnotherPage(int $contentFromAnotherPage): void { public function setContentFromAnotherPage(int $contentFromAnotherPage): void {
$this->contentFromAnotherPage = $contentFromAnotherPage; $this->contentFromAnotherPage = $contentFromAnotherPage;
} }
/**
* @return bool
*/
public function getEnableComments(): bool {
return $this->enableComments;
}
/**
* @param bool $enableComments
*/
public function setEnableComments(bool $enableComments): void {
$this->enableComments = $enableComments;
}
} }
...@@ -445,6 +445,14 @@ if (version_compare(\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::getExten ...@@ -445,6 +445,14 @@ if (version_compare(\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::getExten
'allowLanguageSynchronization' => TRUE 'allowLanguageSynchronization' => TRUE
] ]
] ]
],
'tx_sgnews_comments_enable' => [
'exclude' => TRUE,
'label' => $localLangDbPath . 'pages.tx_sgnews_comments_enable',
'config' => [
'type' => 'check',
'default' => 1
]
] ]
] ]
); );
...@@ -456,7 +464,8 @@ $GLOBALS['TCA']['pages']['palettes']['titleDescriptionAndHighlightFlag'] = [ ...@@ -456,7 +464,8 @@ $GLOBALS['TCA']['pages']['palettes']['titleDescriptionAndHighlightFlag'] = [
--linebreak--, slug, --linebreak--, slug,
--linebreak--, tx_projectbase_path_segment, tx_projectbase_excludefromsluggeneration, --linebreak--, tx_projectbase_path_segment, tx_projectbase_excludefromsluggeneration,
--linebreak--, tx_realurl_pathsegment, tx_realurl_exclude, --linebreak--, tx_realurl_pathsegment, tx_realurl_exclude,
--linebreak--, tx_sgnews_highlighted, tx_sgnews_never_highlighted', --linebreak--, tx_sgnews_highlighted, tx_sgnews_never_highlighted,
--linebreak--, tx_sgnews_comments_enable',
'canNotCollapse' => 1, 'canNotCollapse' => 1,
]; ];
...@@ -492,6 +501,7 @@ foreach ($GLOBALS['TCA']['pages']['columns'] as $languageExcludeField => $_) { ...@@ -492,6 +501,7 @@ foreach ($GLOBALS['TCA']['pages']['columns'] as $languageExcludeField => $_) {
'tx_sgnews_date_end', 'tx_sgnews_date_end',
'tx_sgnews_highlighted', 'tx_sgnews_highlighted',
'tx_sgnews_never_highlighted', 'tx_sgnews_never_highlighted',
'tx_sgnews_comments_enable',
'og_title', 'og_title',
'og_description', 'og_description',
'og_image', 'og_image',
...@@ -523,6 +533,7 @@ foreach ($GLOBALS['TCA']['pages']['columns'] as $languageExcludeField => $_) { ...@@ -523,6 +533,7 @@ foreach ($GLOBALS['TCA']['pages']['columns'] as $languageExcludeField => $_) {
'tx_sgnews_date_end', 'tx_sgnews_date_end',
'tx_sgnews_highlighted', 'tx_sgnews_highlighted',
'tx_sgnews_never_highlighted', 'tx_sgnews_never_highlighted',
'tx_sgnews_comments_enable'
]; ];
} }
if (!in_array($languageExcludeField, $fieldNames)) { if (!in_array($languageExcludeField, $fieldNames)) {
......
...@@ -81,6 +81,10 @@ ...@@ -81,6 +81,10 @@
<source><![CDATA[Use Image Cropping]]></source> <source><![CDATA[Use Image Cropping]]></source>
<target><![CDATA[Bild-Cropping aktivieren]]></target> <target><![CDATA[Bild-Cropping aktivieren]]></target>
</trans-unit> </trans-unit>
<trans-unit id="pages.tx_sgnews_comments_enable" approved="yes">
<source><![CDATA[Enable comments on this page]]></source>
<target><![CDATA[Kommentare auf dieser Seite aktivieren]]></target>
</trans-unit>
<trans-unit id="plugin.flexForm" approved="yes"> <trans-unit id="plugin.flexForm" approved="yes">
<source><![CDATA[Settings]]></source> <source><![CDATA[Settings]]></source>
<target><![CDATA[Einstellungen]]></target> <target><![CDATA[Einstellungen]]></target>
......
...@@ -63,6 +63,9 @@ ...@@ -63,6 +63,9 @@
<trans-unit id="pages.tx_sgnews_use_image_crop"> <trans-unit id="pages.tx_sgnews_use_image_crop">
<source><![CDATA[Use Image Cropping]]></source> <source><![CDATA[Use Image Cropping]]></source>
</trans-unit> </trans-unit>
<trans-unit id="pages.tx_sgnews_comments_enable">
<source><![CDATA[Enable comments on this page]]></source>
</trans-unit>
<trans-unit id="plugin.flexForm"> <trans-unit id="plugin.flexForm">
<source><![CDATA[Settings]]></source> <source><![CDATA[Settings]]></source>
</trans-unit> </trans-unit>
......
...@@ -224,14 +224,16 @@ ...@@ -224,14 +224,16 @@
</div> </div>
</section> </section>
<section class="content"> <f:if condition="{newsMetaData.news.enableComments}">
<div class="container"> <section class="content">
<div class="tx-sgnews-single-comments"> <div class="container">
<div id="comments" class="tx-sgnews-comments-inner"> <div class="tx-sgnews-single-comments">
<f:cObject typoscriptObjectPath="lib.sgCommentsIndex" /> <div id="comments" class="tx-sgnews-comments-inner">
<f:cObject typoscriptObjectPath="lib.sgCommentsIndex" />
</div>
</div> </div>
</div> </div>
</div> </section>
</section> </f:if>
</f:alias> </f:alias>
</f:section> </f:section>
...@@ -10,6 +10,7 @@ CREATE TABLE pages ( ...@@ -10,6 +10,7 @@ CREATE TABLE pages (
tx_sgnews_location mediumtext, tx_sgnews_location mediumtext,
tx_sgnews_date_end int(10) unsigned DEFAULT '0' NOT NULL, tx_sgnews_date_end int(10) unsigned DEFAULT '0' NOT NULL,
tx_sgnews_content_from_another_page int(11) unsigned DEFAULT '0' NOT NULL, tx_sgnews_content_from_another_page int(11) unsigned DEFAULT '0' NOT NULL,
tx_sgnews_comments_enable tinyint(4) unsigned DEFAULT '1' NOT NULL,
KEY news_author (tx_sgnews_news_author) KEY news_author (tx_sgnews_news_author)
); );
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment