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 {
*/
protected $contentFromAnotherPage = 0;
/**
* @var bool
*/
protected $enableComments = TRUE;
/**
* Constructor
*/
......@@ -383,4 +388,18 @@ class News extends CategoryAndNews {
public function setContentFromAnotherPage(int $contentFromAnotherPage): void {
$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
'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'] = [
--linebreak--, slug,
--linebreak--, tx_projectbase_path_segment, tx_projectbase_excludefromsluggeneration,
--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,
];
......@@ -492,6 +501,7 @@ foreach ($GLOBALS['TCA']['pages']['columns'] as $languageExcludeField => $_) {
'tx_sgnews_date_end',
'tx_sgnews_highlighted',
'tx_sgnews_never_highlighted',
'tx_sgnews_comments_enable',
'og_title',
'og_description',
'og_image',
......@@ -523,6 +533,7 @@ foreach ($GLOBALS['TCA']['pages']['columns'] as $languageExcludeField => $_) {
'tx_sgnews_date_end',
'tx_sgnews_highlighted',
'tx_sgnews_never_highlighted',
'tx_sgnews_comments_enable'
];
}
if (!in_array($languageExcludeField, $fieldNames)) {
......
......@@ -81,6 +81,10 @@
<source><![CDATA[Use Image Cropping]]></source>
<target><![CDATA[Bild-Cropping aktivieren]]></target>
</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">
<source><![CDATA[Settings]]></source>
<target><![CDATA[Einstellungen]]></target>
......
......@@ -63,6 +63,9 @@
<trans-unit id="pages.tx_sgnews_use_image_crop">
<source><![CDATA[Use Image Cropping]]></source>
</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">
<source><![CDATA[Settings]]></source>
</trans-unit>
......
......@@ -224,14 +224,16 @@
</div>
</section>
<section class="content">
<div class="container">
<div class="tx-sgnews-single-comments">
<div id="comments" class="tx-sgnews-comments-inner">
<f:cObject typoscriptObjectPath="lib.sgCommentsIndex" />
<f:if condition="{newsMetaData.news.enableComments}">
<section class="content">
<div class="container">
<div class="tx-sgnews-single-comments">
<div id="comments" class="tx-sgnews-comments-inner">
<f:cObject typoscriptObjectPath="lib.sgCommentsIndex" />
</div>
</div>
</div>
</div>
</section>
</section>
</f:if>
</f:alias>
</f:section>
......@@ -10,6 +10,7 @@ CREATE TABLE pages (
tx_sgnews_location mediumtext,
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_comments_enable tinyint(4) unsigned DEFAULT '1' NOT NULL,
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