Skip to content
Snippets Groups Projects
Commit 89ca86fa authored by Fabian Galinski's avatar Fabian Galinski :pouting_cat:
Browse files

[FEATURE] Replacing of pw_comments with sg_comments

parent def0b2db
No related branches found
Tags 3.0.0
No related merge requests found
<?php
namespace SGalinski\SgNews\UserFunction;
/***************************************************************
* Copyright notice
*
* (c) sgalinski Internet Services (http://www.sgalinski.de)
* All rights reserved
*
* This script is part of the TYPO3 project. The TYPO3 project is
* free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* The GNU General Public License can be found at
* http://www.gnu.org/copyleft/gpl.html.
*
* This script is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/
use TYPO3\CMS\Core\SingletonInterface;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Extbase\Domain\Model\FrontendUser;
use TYPO3\CMS\Extbase\Domain\Repository\FrontendUserRepository;
use TYPO3\CMS\Extbase\Object\ObjectManager;
/**
* This class contains the methods, for adding additional mail recipients to the sg_comments TypoScript.
*/
class AddAdditionalMailRecipients implements SingletonInterface {
/**
* @var \TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer
*/
public $cObj;
/**
* Adds the news authors to the additional mail recipients.
*
* @return string
*/
public function addAdditionalMailRecipients() {
$newsAuthorUid = (int) $this->cObj->data['tx_sgnews_author'];
if ($newsAuthorUid > 0) {
/** @var ObjectManager $objectManager */
$objectManager = GeneralUtility::makeInstance(ObjectManager::class);
/** @var FrontendUserRepository $frontendUserRepository */
$frontendUserRepository = $objectManager->get(FrontendUserRepository::class);
/** @var FrontendUser $frontendUser */
$frontendUser = $frontendUserRepository->findByUid($newsAuthorUid);
if ($frontendUser) {
$email = $frontendUser->getEmail();
if (!empty($email)) {
return $email;
}
}
}
$authorEmail = $this->cObj->data['author_email'];
if (empty($authorEmail)) {
return '';
}
return $authorEmail;
}
}
?>
......@@ -91,3 +91,11 @@ plugin.tx_sgnews {
}
}
}
plugin.tx_sgcomments {
settings {
additionalMailRecipients {
preUserFunc = SGalinski\SgNews\UserFunction\AddAdditionalMailRecipients->addAdditionalMailRecipients
}
}
}
......@@ -59,9 +59,7 @@
</span>
<span class="category">
<a href="{f:uri.page(pageUid: '{newsMetaData.category.uid}')}">
{newsMetaData.category.subtitleWithFallbackToTitle}
</a>
{newsMetaData.category.subtitleWithFallbackToTitle}
</span>
</div>
</div>
......
......@@ -63,7 +63,7 @@
<f:alias map="{content: '{f:cObject(typoscriptObjectPath: \'lib.mainContent\')}'}">
<div class="tx-sgnews-single-content">
<p>
<a href="#comments">{f:cObject(typoscriptObjectPath: "lib.pwCommentsGetCountWithLabel")}</a>
<a href="#comments">{f:cObject(typoscriptObjectPath: "lib.sgCommentsGetCountWithLabel")}</a>
<span>//</span>
<f:translate key="frontend.singleview.readingTime" />
<strong>
......
......@@ -250,22 +250,6 @@
display: none;
}
.tx-pwcomment-pi1 form {
h2 {
margin-bottom: 20px;
font-size: 23px;
}
label {
display: none;
}
.typo3-messages .alert {
margin-bottom: 20px;
}
}
.tx-sgnews-comments-item {
margin-bottom: 40px;
......
......@@ -19,7 +19,7 @@ $EM_CONF[$_EXTKEY] = array(
'modify_tables' => '',
'clearCacheOnLoad' => 0,
'lockType' => '',
'version' => '2.2.0',
'version' => '3.0.0',
'constraints' => array(
'depends' => array(
'typo3' => '7.6.0-7.6.99',
......
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