[TYPO3-dev] Re: Access pictures added with foreign_table in plugin view

Dominik J. dominik1991jahn at gmail.com
Fri Nov 7 09:38:29 CET 2014


Figured it out myself. If anybody needs it:

// Get the UID of the current content element (plugin container)
$uid = $this->configurationManager->getContentObject()->data['uid'];

$fileRepository = \TYPO3\CMS\Core\Utility\GeneralUtilityGeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Resource\\FileRepository');
$fileRelations = $fileRepository->findByRelation('tt_content', 'image', $uid);

Now you have access to all the assigned pictures. To get the path of the first assigned picture:

$path = $fileRelations[0]->getPublicUrl();

But you can access all other kind of info, like the title or description of the picture.



More information about the TYPO3-dev mailing list