Commit 10df4bf4 authored by Jonas Götze's avatar Jonas Götze

[FEATURE] Enable multiple Authors for news

parent 3ac8a0d7
Pipeline #9776 failed with stages
in 2 minutes and 2 seconds
......@@ -52,12 +52,12 @@ class News extends \GeorgRinger\News\Domain\Model\News
}
/**
* @return \TYPO3\CMS\Extbase\Domain\Model\FrontendUser|null
* @return \TYPO3\CMS\Extbase\Domain\Model\FrontendUser[]
*/
public function getAuthorFeUser()
{
if (!$this->authorFeUser) {
return null;
return [];
}
$objectManager = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Extbase\Object\ObjectManager::class);
......@@ -66,8 +66,15 @@ class News extends \GeorgRinger\News\Domain\Model\News
$userRepository = $objectManager->get(\TYPO3\CMS\Extbase\Domain\Repository\FrontendUserRepository::class);
$userRepository->setDefaultQuerySettings($querySettings);
$authorFeUsers = [];
foreach(explode(',',$this->authorFeUser) as $username) {
$user = $userRepository->findOneByUsername($username);
if($user !== null) {
$authorFeUsers[] = $user;
}
}
return $userRepository->findOneByUsername($this->authorFeUser);
return $authorFeUsers;
}
/**
......
......@@ -6,7 +6,7 @@ $GLOBALS['TCA']['tx_news_domain_model_news']['columns']['author_fe_user'] = [
'config' => [
'type' => 'select',
'minitems' => 0,
'maxitems' => 1,
'maxitems' => 99,
'renderType' => 'selectMultipleSideBySide',
'enableMultiSelectFilterTextfield' => true,
'itemsProcFunc' => \T3o\T3orgLayout\TCA\TcaProcFunc::class . '->feUserItems',
......
......@@ -4,6 +4,7 @@ plugin.tx_news {
templateRootPaths {
0 = EXT:news/Resources/Private/Templates/
1 = EXT:t3olayout/Resources/Private/Templates/News/
2 = EXT:t3org_layout/Resources/Private/Templates/News/
}
partialRootPaths >
......
......@@ -125,10 +125,27 @@
</f:if>
</span>
</f:for>
<f:if condition="{newsItem.authorFeUser}">
<f:if condition="{newsItem.authorFeUser -> f:count()} > 0">
<f:then>
<span class="news-list__item-author d-block small"><f:translate key="author" arguments="{0:dd.authorFeUser.name}" /> {newsItem.authorFeUser.name}</span>
<f:format.raw><t3o:gravatar emailAddress="{newsItem.authorFeUser.email}" size="40" class="gravatar" /></f:format.raw>
<span class="news-list__item-author d-block small">
<f:translate key="author" arguments="{0:dd.authorFeUser.name}" />
<f:for each="{newsItem.authorFeUser}" as="authorFeUser" iteration="authorFeUserIterator">
<f:if condition="{authorFeUserIterator.isFirst} === false">
<f:if condition="{authorFeUserIterator.isLast} === true">
<f:then>
and
</f:then>
<f:else>
,
</f:else>
</f:if>
</f:if>
{authorFeUser.name}
<f:if condition="{authorFeUser.email}">
<f:format.raw><t3o:gravatar emailAddress="{authorFeUser.email}" size="40" class="gravatar" /></f:format.raw>
</f:if>
</f:for>
</span>
</f:then>
<f:else>
<f:if condition="{newsItem.author}">
......
......@@ -9,7 +9,7 @@ CREATE TABLE tx_sfeventmgt_domain_model_event (
# Table structure for table 'tx_news_domain_model_news'
#
CREATE TABLE tx_news_domain_model_news (
author_fe_user varchar(30) DEFAULT '' NOT NULL,
author_fe_user varchar(100) DEFAULT '' NOT NULL,
default_image varchar(30) DEFAULT '' NOT NULL,
contributors int DEFAULT 0
);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment