Skip to content

Commit

Permalink
feat: make typo3 v12 compatible
Browse files Browse the repository at this point in the history
  • Loading branch information
carsten-walther committed May 15, 2023
1 parent debfb14 commit 13ffde8
Show file tree
Hide file tree
Showing 14 changed files with 334 additions and 189 deletions.
53 changes: 37 additions & 16 deletions Classes/Controller/ImageCopyrightController.php
@@ -1,16 +1,18 @@
<?php

namespace Walther\ImageCopyright\Controller;
namespace CarstenWalther\ImageCopyright\Controller;

use Walther\ImageCopyright\Resource\FileRepository;
use CarstenWalther\ImageCopyright\Resource\FileRepository;
use Doctrine\DBAL\Driver\Exception;
use Psr\Http\Message\ResponseInterface;
use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Extbase\Mvc\Controller\ActionController;

/**
* Class ImageCopyrightController
*
* @package Walther\ImageCopyright\Controller
* @package CarstenWalther\ImageCopyright\Controller
*/
class ImageCopyrightController extends ActionController
{
Expand Down Expand Up @@ -45,16 +47,16 @@ class ImageCopyrightController extends ActionController
protected array $tableFieldConfigurationForCollections = [];

/**
* @var \Walther\ImageCopyright\Resource\FileRepository
* @var FileRepository
*/
protected FileRepository $fileRepository;

/**
* injectFileRepository
*
* @param \Walther\ImageCopyright\Resource\FileRepository $fileRepository
* @param FileRepository $fileRepository
*/
public function injectFileRepository(FileRepository $fileRepository) : void
public function injectFileRepository(FileRepository $fileRepository): void
{
$this->fileRepository = $fileRepository;
}
Expand All @@ -64,7 +66,7 @@ public function injectFileRepository(FileRepository $fileRepository) : void
*
* @return void
*/
public function initializeAction() : void
public function initializeAction(): void
{
$this->cObjectData = $this->configurationManager->getContentObject()->data;

Expand Down Expand Up @@ -92,40 +94,59 @@ public function initializeAction() : void
}
}
}

parent::initializeAction();
}

/**
* indexAction
*
* @return void
* @throws \Doctrine\DBAL\Driver\Exception
* @return ResponseInterface
* @throws Exception
* @throws \Doctrine\DBAL\Exception
*/
public function indexAction() : void
public function indexAction(): ResponseInterface
{
$this->view->assignMultiple([
'images' => $this->fileRepository->findAllByRelation($this->tableFieldConfiguration, $this->tableFieldConfigurationForCollections, $this->extensions, $this->showEmpty, null)
'images' => $this->fileRepository->findAllByRelation(
$this->tableFieldConfiguration,
$this->tableFieldConfigurationForCollections,
$this->extensions,
$this->showEmpty
)
]);

return $this->htmlResponse();
}

/**
* indexOnPageAction
*
* @return void
* @throws \Doctrine\DBAL\Driver\Exception
* @return ResponseInterface
* @throws Exception
* @throws \Doctrine\DBAL\Exception
*/
public function indexOnPageAction() : void
public function indexOnPageAction(): ResponseInterface
{
$this->view->assignMultiple([
'images' => $this->fileRepository->findAllByRelation($this->tableFieldConfiguration, $this->tableFieldConfigurationForCollections, $this->extensions, $this->showEmpty, $this->cObjectData['pid'])
'images' => $this->fileRepository->findAllByRelation(
$this->tableFieldConfiguration,
$this->tableFieldConfigurationForCollections,
$this->extensions,
$this->showEmpty,
$this->cObjectData['pid']
)
]);

return $this->htmlResponse();
}

/**
* @param bool $showEmpty
*
* @return ImageCopyrightController
*/
public function setShowEmpty(bool $showEmpty) : ImageCopyrightController
public function setShowEmpty(bool $showEmpty): ImageCopyrightController
{
$this->showEmpty = $showEmpty;
return $this;
Expand Down

0 comments on commit 13ffde8

Please sign in to comment.