Access Images in new field with sys_file_reference in tx_news

147 Views Asked by At

I've added several fields to extend the tx_news, some of them should include images. For that I created fields with ...'type' => 'inline','foreign_table' => 'sys_file_reference'..., and it works fine in the backend. Now I want to access the images via Fluid and show them in my news (list and detail), but I cannot manage to get it work. Normal fields I can show with {newsItem.fieldname}, but here I get only the reference. I tried several ways with FilesProcessor, but I cannot get it work, for example:

dataProcessing{
    10 = TYPO3\CMS\Frontend\DataProcessing\FilesProcessor
    10 {
        references {
            table = tx_news_domain_model_news
            fieldName = fieldname
        }
        as = images
    }
}

I am happy for any suggestion! Thanks

EDIT: Here is a part of my tx_news_domain_model_news.php

'tx_csnewsextend_adressefoto' => [
        'label' => 'Landkarte',
        'exclude' => 1,
        'config' => [
            'type' => 'inline',
            'foreign_table' => 'sys_file_reference',
            'foreign_field' => 'uid_foreign',
            'foreign_sortby' => 'sorting_foreign',
            'foreign_table_field' => 'tablenames',
            'foreign_match_fields' => [
                'fieldname' => 'adressefotos',
            ],
            'foreign_label' => 'uid_local',
            'foreign_selector' => 'uid_local',
            'overrideChildTca' => [
                'columns' => [
                    'uid_local' => [
                        'config' => [
                            'appearance' => [
                                'elementBrowserType' => 'file',
                                'elementBrowserAllowed' => 'gif,jpg,jpeg,tif,tiff,bmp,pcx,tga,png,pdf,ai,svg',
                            ],
                        ],
                    ],
                    'crop' => [
                        'description' => 'field description',
                    ],
                ],
                'types' => [
                    2 => [
                        'showitem' => '
                            --palette--;;imageoverlayPalette,
                            --palette--;;filePalette',
                    ],
                ],
            ],
            'maxitems' => 1,
            'filter' => [
                [
                    'userFunc' => 'TYPO3\\CMS\\Core\\Resource\\Filter\\FileExtensionFilter->filterInlineChildren',
                    'parameters' => [
                        'allowedFileExtensions' => 'gif,jpg,jpeg,tif,tiff,bmp,pcx,tga,png,pdf,ai,svg',
                        'disallowedFileExtensions' => '',
                    ],
                ],
            ],
            'appearance' => [
                'useSortable' => true,
                'headerThumbnail' => [
                    'field' => 'uid_local',
                    'height' => '45m',
                ],
                'enabledControls' => [
                    'info' => true,
                    'new' => false,
                    'dragdrop' => true,
                    'sort' => false,
                    'hide' => true,
                    'delete' => true,
                ],
                'createNewRelationLinkTitle' => 'LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:images.addFileReference',
            ],
        ],
    ],

EDIT 2: Here is the news.php

class News extends \GeorgRinger\News\Domain\Model\News
{
    /**
     * @var string
     */
    protected $txCsnewsextendAdresse;

    /**
     * @return string
     */
    public function getTxCsnewsextendAdresse()
    {
        return $this->txCsnewsextendAdresse;
    }

    /**
     * @param string $txCsnewsextendAdresse
     */
    public function setTxCsnewsextendAdresse($txCsnewsextendAdresse)
    {
        $this->txCsnewsextendAdresse = $txCsnewsextendAdresse;
    }
    
    /****************************************/
    
    /**
     * @var string
     */
    protected $txCsnewsextendAdressesonstiges;

    /**
     * @return string
     */
    public function getTxCsnewsextendAdressesonstiges()
    {
        return $this->txCsnewsextendAdressesonstiges;
    }

    /**
     * @param string $txCsnewsextendAdressesonstiges
     */
    public function setTxCsnewsextendAdressesonstiges($txCsnewsextendAdressesonstiges)
    {
        $this->txCsnewsextendAdressesonstiges = $txCsnewsextendAdressesonstiges;
    }
    
    /****************************************/
    
    /**
     * @var string
     */
    protected $txCsnewsextendAdressefoto;

    /**
     * @return string
     */
    public function getTxCsnewsextendAdressefoto()
    {
        return $this->txCsnewsextendAdressefoto;
    }

    /**
     * @param string $txCsnewsextendAdressefoto
     */
    public function setTxCsnewsextendAdressefoto($txCsnewsextendAdressefoto)
    {
        $this->txCsnewsextendAdressefoto = $txCsnewsextendAdressefoto;
    }
    
    /****************************************/
    
    /**
     * @var string
     */
    protected $txCsnewsextendGeschichte;
    /**
     * @return string
     */
    public function getTxCsnewsextendGeschichte()
    {
        return $this->txCsnewsextendGeschichte;
    }

    /**
     * @param string $txCsnewsextendGeschichte
     */
    public function setTxCsnewsextendGeschichte($txCsnewsextendGeschichte)
    {
        $this->txCsnewsextendGeschichte = $txCsnewsextendGeschichte;
    }
    
    /****************************************/
}

0

There are 0 best solutions below