Skip to content
Merged
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
27 changes: 13 additions & 14 deletions Classes/Backend/Form/Element/TagsElement.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,35 +5,31 @@
namespace Zeroseven\Pagebased\Backend\Form\Element;

use TYPO3\CMS\Backend\Form\Element\AbstractFormElement;
use TYPO3\CMS\Backend\Form\NodeFactory;
use TYPO3\CMS\Core\Page\JavaScriptModuleInstruction;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use Zeroseven\Pagebased\Exception\ValueException;
use TYPO3\CMS\Core\Utility\StringUtility;
use Zeroseven\Pagebased\Registration\Registration;
use Zeroseven\Pagebased\Registration\RegistrationService;
use Zeroseven\Pagebased\Utility\DetectionUtility;
use Zeroseven\Pagebased\Utility\TagUtility;

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 @@ -69,6 +65,7 @@ protected function renderHtml(): string

return '
<div class="form-control-wrap">
<legend class="form-label t3js-formengine-label">' . htmlspecialchars($this->data['parameterArray']['fieldConf']['label'] ?? '') . '</legend>
<div class="form-wizards-wrap">
<div class="form-wizards-element">' . $formField . '</div>
<div class="form-wizards-items-bottom">' . ($fieldWizardResult['html'] ?? '') . '</div>
Expand All @@ -79,6 +76,8 @@ protected function renderHtml(): string

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

$result = $this->initializeResultArray();

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

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

protected function resolveView(): ViewInterface
Expand Down
19 changes: 10 additions & 9 deletions Classes/Controller/AbstractObjectController.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@

namespace Zeroseven\Pagebased\Controller;

use Doctrine\DBAL\DBALException;
use Doctrine\DBAL\Driver\Exception;
use Doctrine\DBAL\ParameterType;
use Psr\Http\Message\ResponseInterface;
use TYPO3\CMS\Core\Database\ConnectionPool;
use TYPO3\CMS\Core\EventDispatcher\EventDispatcher;
Expand Down Expand Up @@ -72,26 +72,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 @@ -127,10 +128,10 @@ protected function getPluginSettings(int $uid): ?array
$flexForm = $queryBuilder
->select('pi_flexform')
->from('tt_content')
->where($queryBuilder->expr()->eq('uid', $queryBuilder->createNamedParameter($uid, \PDO::PARAM_INT)))
->where($queryBuilder->expr()->eq('uid', $queryBuilder->createNamedParameter($uid, ParameterType::INTEGER)))
->executeQuery()
->fetchOne();
} catch (DBALException | Exception $e) {
} catch (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 @@ -84,7 +84,8 @@ protected function getType(\ReflectionProperty $reflection, array $tableDefiniti

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

Expand Down Expand Up @@ -112,7 +113,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
4 changes: 3 additions & 1 deletion 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
1 change: 0 additions & 1 deletion Classes/Utility/ObjectUtility.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ public static function isSystemPage(int $pageUid = null, array $row = null): boo
PageRepository::DOKTYPE_MOUNTPOINT,
PageRepository::DOKTYPE_SPACER,
PageRepository::DOKTYPE_SYSFOLDER,
PageRepository::DOKTYPE_RECYCLER,
], true);
}

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

use TYPO3\CMS\Core\Configuration\Features;
use TYPO3\CMS\Core\Context\LanguageAspect;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Extbase\Persistence\QueryResultInterface;
use Zeroseven\Pagebased\Domain\Model\Demand\ObjectDemandInterface;
Expand Down Expand Up @@ -97,9 +98,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
2 changes: 2 additions & 0 deletions Configuration/Sets/Pagebased/config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
name: zeroseven/pagebased
label: 'Pagebased'
1 change: 1 addition & 0 deletions Configuration/Sets/Pagebased/setup.typoscript
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
page.includeJSFooter.pagebased_pagination = EXT:pagebased/Resources/Public/JavaScript/Pagination.js
41 changes: 41 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -246,3 +246,44 @@ The editor receives a note in the backend for which objects there are, e.g. a co
### Do I mandatorily need an object category?

Yes! The subpages of an object category are automatically identified as objects. Therefore, it is necessary to create a category first. The category behaves, similarly to objects, like a "normal" TYPO3 page.

## Changelog

### Unreleased (2026-04-10)

- **Language parameter**: Add optional language UID parameter to findTagStrings method
- **SEO improvements**: Add rel="nofollow" attribute to tag filter links

### 2.1.0 (2026-03-05)

- **Performance optimization**: Major performance improvements with caching, O(1) registration lookup index, and optimized tag queries
- **Database efficiency**: Add database indexes and RootLine cache, replace deprecated QueryBuilder::execute()
- **Development**: Add CI/CD workflows, GitHub Actions, DDEV test runner, and comprehensive unit/functional tests
- **Tag management**: Add nonglobal tag scoping via feature flag, optimize tag deduplication
- **Bug fixes**: Fix SQL array binding, functional tests, and deprecated method usage

### 2.0.1 (2025-11-27)

- **Bug fixes**: Ensure fallback for null value when fetching tags in TagsElement

### 2.0.0 (2025-01-31)

- **Relations management**: Filter and maintain relations in default language only
- **Object handling improvements**: Update object handling from detaching to attaching
- **Error handling**: Catch siteFinder errors in TCA event
- **Code modernization**: Update FlashMessage severity to ContextualFeedbackSeverity

### 1.4.0 (2024-10-10)

- **Global categories feature**: Merge global categories support
- **Child objects support**: Add option to show/hide child objects with new isChildObject property
- **Category improvements**: Fix category selection and TCA improvements
- **Stage selection**: Add pagination link to select stage
- **Topics ordering**: Order topics by title

### 1.3.0 (2023-11-08)

- **TYPO3 12 support**: Full compatibility with TYPO3 12
- **Deprecation fixes**: Fix deprecations #100053 and #97787
- **TCA migration**: Migrate TCA to new syntax
- **Event system**: Change event for registration validation
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
}
],
"require": {
"typo3/cms-core": "^12.4.0",
"typo3/cms-core": "^13.4",
"zeroseven/pagebased": "*"
},
"autoload": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@
// 'author_company' => 'Company name',
'state' => 'stable',
'clearCacheOnLoad' => 1,
'version' => '0.0.0',
'version' => '1.0.0',
'constraints' => [
'depends' => [
'typo3' => '12.4.0-12.4.99',
'typo3' => '13.4.0-13.4.99',
'pagebased' => ''
]
]
Expand Down
Loading