[BUGFIX] Cope with negative PID when adding new CEs

Resolves: #11
This commit is contained in:
Markus Klein 2021-01-29 16:40:15 +01:00
parent c5b2a0eec9
commit 8e46c143ce

View file

@ -5,6 +5,7 @@ declare(strict_types=1);
namespace SkillDisplay\SkilldisplayContent;
use SkillDisplay\PHPToolKit\Entity\Campaign;
use TYPO3\CMS\Backend\Utility\BackendUtility;
class TcaEnhancer
{
@ -25,9 +26,9 @@ class TcaEnhancer
['', 0],
];
$campaigns = $this->campaignsFactory
->createFromPageUid($params['row']['pid'])
->getForUser();
$pid = BackendUtility::getTSconfig_pidValue('tt_content', $params['row']['uid'], $params['row']['pid']);
if ($pid > 0) {
$campaigns = $this->campaignsFactory->createFromPageUid($pid)->getForUser();
/** @var Campaign $campaign */
foreach ($campaigns as $campaign) {
$params['items'][] = [
@ -36,4 +37,5 @@ class TcaEnhancer
];
}
}
}
}