Reputation: 1
I'm trying to implement a custom media field 'fal_more_media' in tx_news, according to the manual here https://docs.typo3.org/p/georgringer/news/main/en-us/Tutorials/ExtendNews/ProxyClassGenerator/Index.html
Simple text fields work fine but I can't get any output when using this syntax for additional FAL Media items, the getFalMoreMedia() Function always returns an empty result.
this is what I've got in /typo3conf/ext/newsextend/Classes/Domain/Model/News.php
namespace Stiller\Newsextend\Domain\Model;
class News extends \GeorgRinger\News\Domain\Model\News
{
protected $falMoreMedia;
public function __construct()
{
$this->falMoreMedia = new ObjectStorage();
}
public function getFalMoreMedia(): ?ObjectStorage
{
return $this->falMoreMedia;
}
public function getMoreMedia(): ?ObjectStorage
{
return $this->getFalMoreMedia();
}
public function setFalMoreMedia(ObjectStorage $falMoreMedia): void
{
$this->falMoreMedia = $falMoreMedia;
}
public function addFalMoreMedia(FileReference $falMoreMedia): void
{
if ($this->getFalMoreMedia() === null) {
$this->falMoreMedia = new ObjectStorage();
}
$this->falMoreMedia->attach($falMoreMedia);
}
}
/typo3conf/ext/newsextend/Configuration/TCA/Override/tx_news_domain_model_news.php
defined('TYPO3') or die;
$fields = [
'fal_more_media' => [
'exclude' => true,
'label' => $ll . 'tx_news_domain_model_news.fal_more_media',
'config' => [
'type' => 'file',
'appearance' => [
'createNewRelationLinkTitle' => $ll . 'tx_news_domain_model_news.fal_more_media.add',
'showPossibleLocalizationRecords' => true,
'showAllLocalizationLink' => true,
'showSynchronizationLink' => true,
],
'behaviour' => [
'allowLanguageSynchronization' => true,
],
'inline' => [
'inlineOnlineMediaAddButtonStyle' => 'display:none',
],
],
],
];
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addTCAcolumns('tx_news_domain_model_news', $fields);
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addToAllTCAtypes('tx_news_domain_model_news', 'fal_more_media');
What is missing? In the TYPO3 Backend the field is displayed and I can add media files as intended. see also Access Images in new field with sys_file_reference in tx_news
Upvotes: 0
Views: 38