Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 12 additions & 12 deletions Classes/Backend/Form/Element/TagsElement.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
use TYPO3\CMS\Backend\Form\NodeFactory;
use TYPO3\CMS\Core\Page\JavaScriptModuleInstruction;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Core\Utility\StringUtility;
use Zeroseven\Pagebased\Exception\ValueException;
use Zeroseven\Pagebased\Registration\Registration;
use Zeroseven\Pagebased\Registration\RegistrationService;
Expand All @@ -16,24 +17,21 @@

class TagsElement extends AbstractFormElement
{
protected string $name;
protected string $id;
protected string $value;
protected string $placeholder;
protected ?Registration $registration;
protected int $languageUid;

/** @throws ValueException */
public function __construct(NodeFactory $nodeFactory, array $data)
protected string $name = '';
protected string $id = '';
protected string $value = '';
protected string $placeholder = '';
protected ?Registration $registration = null;
protected int $languageUid = 0;

private function initializeFromData(): void
{
parent::__construct($nodeFactory, $data);

$parameterArray = $this->data['parameterArray'] ?? [];
$placeholder = $parameterArray['fieldConf']['config']['placeholder'] ?? '';
$sysLanguageUid = $this->data['databaseRow']['sys_language_uid'] ?? 0;

$this->name = $parameterArray['itemFormElName'] ?? '';
$this->id = $parameterArray['itemFormElID'] ?? '';
$this->id = StringUtility::getUniqueId('pagebased-tags');
$this->value = $parameterArray['itemFormElValue'] ?? '';
$this->placeholder = str_starts_with($placeholder, 'LLL') ? $this->getLanguageService()->sL($placeholder) : $placeholder;
$this->languageUid = (int)($sysLanguageUid[0] ?? $sysLanguageUid);
Expand Down Expand Up @@ -79,6 +77,8 @@ protected function renderHtml(): string

public function render(): array
{
$this->initializeFromData();

$result = $this->initializeResultArray();

if ($html = $this->renderHtml()) {
Expand Down
3 changes: 1 addition & 2 deletions Classes/Controller/AbstractController.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@ public function initializeAction(): void
{
parent::initializeAction();

/** @extensionScannerIgnoreLine */
$this->contentData = $this->configurationManager->getContentObject()->data;
$this->contentData = $this->request->getAttribute('currentContentObject');
}

protected function resolveView(): ViewInterface
Expand Down
15 changes: 8 additions & 7 deletions Classes/Controller/AbstractObjectController.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,26 +73,27 @@ protected function initializeRequestArguments(): void
/** @throws TypeException */
protected function controlCache(): void
{
if (($GLOBALS['TSFE'] ?? null) instanceof TypoScriptFrontendController && $GLOBALS['TSFE']->no_cache === false) {
if (($GLOBALS['TSFE'] ?? null) instanceof TypoScriptFrontendController) {
$demandArguments = array_filter(array_keys($this->requestArguments), fn(string $argument) => $this->demand->hasProperty($argument));

// Limit caching on multiple arguments
if (count($demandArguments) > 2) {
$GLOBALS['TSFE']->no_cache = true;
$GLOBALS['TSFE']->set_no_cache();
return;
}

// Limit pagination
if ((int)($this->requestArguments[PaginationViewHelper::REQUEST_ARGUMENT] ?? 0) > 3) {
$GLOBALS['TSFE']->no_cache = true;
$GLOBALS['TSFE']->set_no_cache();
return;
}

// Limit caching on multiple array values
foreach ($demandArguments as $argument) {
$this->demand->getProperty($argument)->isArray()
&& count(CastUtility::array($this->requestArguments[$argument] ?? null)) > 1
&& $GLOBALS['TSFE']->no_cache = true;
if ($this->demand->getProperty($argument)->isArray()
&& count(CastUtility::array($this->requestArguments[$argument] ?? null)) > 1) {
$GLOBALS['TSFE']->set_no_cache();
}
}
}
}
Expand Down Expand Up @@ -129,7 +130,7 @@ protected function getPluginSettings(int $uid): ?array
->select('pi_flexform')
->from('tt_content')
->where($queryBuilder->expr()->eq('uid', $queryBuilder->createNamedParameter($uid, PDO::PARAM_INT)))
->execute()
->executeQuery()
->fetchOne();
} catch (DBALException | Exception $e) {
return null;
Expand Down
5 changes: 3 additions & 2 deletions Classes/Domain/Model/Demand/AbstractDemand.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,8 @@ protected function getType(ReflectionProperty $reflection, array $tableDefinitio

// Check table definition
if (($column = $tableDefinition[$columnMap->getColumnName()] ?? null) && $type = $column->getType()) {
if ($type->getName() === 'smallint') {
$typeName = $type->getName();
if (str_contains($typeName, 'SmallInt') || $typeName === 'smallint') {
return DemandProperty::TYPE_BOOLEAN;
}

Expand Down Expand Up @@ -114,7 +115,7 @@ public function detectPropertiesFromClass(string $className): self
if ($dataMap) {
$queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getConnectionForTable($dataMap->getTableName());

if (($schemaManager = $queryBuilder->getSchemaManager()) && $tableDefinition = $schemaManager->listTableColumns($dataMap->getTableName())) {
if (($schemaManager = $queryBuilder->createSchemaManager()) && $tableDefinition = $schemaManager->listTableColumns($dataMap->getTableName())) {
foreach (GeneralUtility::makeInstance(ReflectionClass::class, $dataMap->getClassName())->getProperties() ?? [] as $reflection) {
$name = $reflection->getName();

Expand Down
6 changes: 4 additions & 2 deletions Classes/Middleware/RssFeed.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
use Psr\Http\Server\MiddlewareInterface;
use Psr\Http\Server\RequestHandlerInterface;
use TYPO3\CMS\Core\Cache\Frontend\FrontendInterface;
use TYPO3\CMS\Core\Context\LanguageAspect;
use TYPO3\CMS\Core\Database\ConnectionPool;
use TYPO3\CMS\Core\Error\Http\PageNotFoundException;
use TYPO3\CMS\Core\EventDispatcher\EventDispatcher;
Expand Down Expand Up @@ -67,7 +68,8 @@ protected function getObjects(Registration $registration, array $settings, SiteL

if ($languageId = $language->getLanguageId()) {
$querySettings = $repository->getDefaultQuerySettings();
$querySettings->setLanguageUid($languageId);
$languageAspect = new LanguageAspect($languageId, $languageId, LanguageAspect::OVERLAYS_MIXED);
$querySettings->setLanguageAspect($languageAspect);
$repository->setDefaultQuerySettings($querySettings);
}

Expand Down Expand Up @@ -126,7 +128,7 @@ public function process(ServerRequestInterface $request, RequestHandlerInterface
)
->orderBy($GLOBALS['TCA'][self::TABLE_NAME]['ctrl']['sortby'])
->setMaxResults(1)
->execute()
->executeQuery()
->fetchAllAssociative()[0] ?? null;

if (
Expand Down
3 changes: 1 addition & 2 deletions Classes/Utility/ObjectUtility.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,7 @@ public static function isSystemPage(int $pageUid = null, array $row = null): boo
PageRepository::DOKTYPE_BE_USER_SECTION,
PageRepository::DOKTYPE_MOUNTPOINT,
PageRepository::DOKTYPE_SPACER,
PageRepository::DOKTYPE_SYSFOLDER,
PageRepository::DOKTYPE_RECYCLER
PageRepository::DOKTYPE_SYSFOLDER
], true);
}

Expand Down
8 changes: 4 additions & 4 deletions Classes/Utility/RootLineUtility.php
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ protected static function getStartingPoint(array &$list, int $startingPoint, Que
$queryBuilder->where($queryBuilder->expr()->eq('uid', $queryBuilder->createNamedParameter($startingPoint, Connection::PARAM_INT)))
->orWhere($queryBuilder->expr()->eq('l10n_parent', $queryBuilder->createNamedParameter($startingPoint, Connection::PARAM_INT)));

foreach ($queryBuilder->execute()->fetchAllAssociative() as $row) {
foreach ($queryBuilder->executeQuery()->fetchAllAssociative() as $row) {
if ($uid = (int)($row['uid'] ?? 0)) {
$list[$uid] = $row;
}
Expand All @@ -143,7 +143,7 @@ protected static function lookUp(array &$list, int $pid, int $looped, int $depth
if ($pid > 0 && $looped <= $depth) {
$queryBuilder->where($queryBuilder->expr()->eq('uid', $queryBuilder->createNamedParameter($pid, Connection::PARAM_INT)));

$statement = $queryBuilder->execute();
$statement = $queryBuilder->executeQuery();
while ($row = $statement->fetchAssociative()) {
if ($uid = (int)($row['uid'] ?? 0)) {
if ($looped) {
Expand All @@ -164,7 +164,7 @@ protected static function lookDown(array &$list, int $uid, int $looped, int $dep
if ($looped < $depth) {
$queryBuilder->where($queryBuilder->expr()->eq('pid', $queryBuilder->createNamedParameter($uid, Connection::PARAM_INT)));

$statement = $queryBuilder->execute();
$statement = $queryBuilder->executeQuery();
while ($row = $statement->fetchAssociative()) {
if ($uid = (int)($row['uid'] ?? 0)) {
$list[$uid] = $row;
Expand Down Expand Up @@ -196,7 +196,7 @@ protected static function searchContentElementInRootline(int $pid, string $plugi
$queryBuilder->andWhere(...$constraints);

// An element with the same CType can be found on the given pid
if (count($result = $queryBuilder->execute()->fetchAllAssociative())) {
if (count($result = $queryBuilder->executeQuery()->fetchAllAssociative())) {
return $result[0];
}

Expand Down
10 changes: 7 additions & 3 deletions Classes/Utility/TagUtility.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

namespace Zeroseven\Pagebased\Utility;

use TYPO3\CMS\Core\Context\LanguageAspect;
use TYPO3\CMS\Extbase\Persistence\QueryResultInterface;
use Zeroseven\Pagebased\Domain\Model\Demand\ObjectDemandInterface;
use Zeroseven\Pagebased\Domain\Repository\RepositoryInterface;
Expand Down Expand Up @@ -34,9 +35,12 @@ public static function getTags(ObjectDemandInterface $demand, RepositoryInterfac
if ($languageUid !== null) {
$querySettings = $repository->getDefaultQuerySettings();

$languageUid === -1
? $querySettings->setRespectSysLanguage(false)
: $querySettings->setLanguageUid($languageUid);
if ($languageUid === -1) {
$querySettings->setRespectSysLanguage(false);
} else {
$languageAspect = new LanguageAspect($languageUid, $languageUid, LanguageAspect::OVERLAYS_MIXED);
$querySettings->setLanguageAspect($languageAspect);
}

$repository->setDefaultQuerySettings($querySettings);
}
Expand Down
Loading