diff --git a/Classes/Domain/Index/TcaIndexer/PagesIndexer.php b/Classes/Domain/Index/TcaIndexer/PagesIndexer.php index 2c0833e..b5ddf56 100644 --- a/Classes/Domain/Index/TcaIndexer/PagesIndexer.php +++ b/Classes/Domain/Index/TcaIndexer/PagesIndexer.php @@ -124,18 +124,7 @@ class PagesIndexer extends TcaIndexer */ protected function getContentElementImages($uidOfContentElement) { - $imageRelationUids = []; - $imageRelations = $this->fileRepository->findByRelation( - 'tt_content', - 'image', - $uidOfContentElement - ); - - foreach ($imageRelations as $relation) { - $imageRelationUids[] = $relation->getUid(); - } - - return $imageRelationUids; + return $this->fetchSysFileReferenceUids($uidOfContentElement, 'tt_content', 'image'); } /** @@ -143,13 +132,20 @@ class PagesIndexer extends TcaIndexer * @return [] */ protected function fetchMediaForPage($uid) + { + return $this->fetchSysFileReferenceUids($uid, 'pages', 'media'); + } + + /** + * @param int $uid + * @param string $tablename + * @param string $fieldname + * @return [] + */ + protected function fetchSysFileReferenceUids($uid, $tablename, $fieldname) { $imageRelationUids = []; - $imageRelations = $this->fileRepository->findByRelation( - 'pages', - 'media', - $uid - ); + $imageRelations = $this->fileRepository->findByRelation($tablename, $fieldname, $uid); foreach ($imageRelations as $relation) { $imageRelationUids[] = $relation->getUid();