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
12 changes: 3 additions & 9 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
TYPO3: [ '12', '13', '14' ]
TYPO3: [ '13', '14' ]
php: [ '8.2', '8.5']

steps:
- name: Checkout
Expand All @@ -17,7 +18,7 @@ jobs:
- name: Set up PHP Version
uses: shivammathur/setup-php@v2
with:
php-version: 8.3
php-version: ${{ matrix.php }}
tools: composer:v2

- name: Start MySQL
Expand All @@ -40,19 +41,12 @@ jobs:
if: matrix.TYPO3 == '13'
run: |
composer require typo3/cms-core:^13.4 --no-progress --no-interaction --dev -W
- name: Install composer dependencies TYPO3 12
if: matrix.TYPO3 == '12'
run: |
composer require typo3/cms-core:^12.4 --no-progress --no-interaction --dev -W
- name: Phpstan 13
if: matrix.TYPO3 == '13'
run: .Build/bin/phpstan analyze -c Build/phpstan13.neon
- name: Phpstan 14
if: matrix.TYPO3 == '14'
run: .Build/bin/phpstan analyze -c Build/phpstan.neon
- name: Phpstan 12
if: matrix.TYPO3 == '12'
run: .Build/bin/phpstan analyze -c Build/phpstan12.neon
- name: Phpcsfix
run: .Build/bin/php-cs-fixer fix --config=Build/php-cs-fixer.php --dry-run --stop-on-violation --using-cache=no
- name: Functional Tests
Expand Down
21 changes: 0 additions & 21 deletions Build/phpstan-baseline.neon

This file was deleted.

4 changes: 1 addition & 3 deletions Build/phpstan.neon
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
includes:
- phpstan-baseline.neon
parameters:
level: 5
paths:
- %currentWorkingDirectory%/Classes
excludePaths:
- %currentWorkingDirectory%/Classes/Hooks/DrawItem.php
- %currentWorkingDirectory%/Classes/Listener/PageContentPreviewRendering.php
9 changes: 0 additions & 9 deletions Build/phpstan11.neon

This file was deleted.

9 changes: 0 additions & 9 deletions Build/phpstan12.neon

This file was deleted.

4 changes: 1 addition & 3 deletions Build/phpstan13.neon
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
parameters:
level: 5
paths:
- %currentWorkingDirectory%/Classes
excludePaths:
- %currentWorkingDirectory%/Classes/Hooks/DrawItem.php
- %currentWorkingDirectory%/Classes
9 changes: 3 additions & 6 deletions Classes/DataProcessing/ListItemsDataProcessor.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,17 @@
*/

use B13\Listelements\Service\ListService;
use Symfony\Component\DependencyInjection\Attribute\Autoconfigure;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Frontend\ContentObject\ContentDataProcessor;
use TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer;
use TYPO3\CMS\Frontend\ContentObject\DataProcessorInterface;

#[Autoconfigure(public: true)]
class ListItemsDataProcessor implements DataProcessorInterface
{
protected ListService $listService;
protected ContentDataProcessor $contentDataProcessor;

public function __construct(ListService $listService, ContentDataProcessor $contentDataProcessor)
public function __construct(protected ListService $listService, protected ContentDataProcessor $contentDataProcessor)
{
$this->listService = $listService;
$this->contentDataProcessor = $contentDataProcessor;
}

public function process(
Expand Down
50 changes: 0 additions & 50 deletions Classes/Hooks/DrawItem.php

This file was deleted.

7 changes: 3 additions & 4 deletions Classes/Listener/PageContentPreviewRendering.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,14 @@

use B13\Listelements\Service\ListService;
use TYPO3\CMS\Backend\View\Event\PageContentPreviewRenderingEvent;
use TYPO3\CMS\Core\Attribute\AsEventListener;
use TYPO3\CMS\Core\Information\Typo3Version;

#[AsEventListener(identifier: 'b13-listelements-page-content-preview-rendering')]
class PageContentPreviewRendering
{
protected ListService $listService;

public function __construct(ListService $listService)
public function __construct(protected ListService $listService)
{
$this->listService = $listService;
}

public function __invoke(PageContentPreviewRenderingEvent $event): void
Expand Down
25 changes: 8 additions & 17 deletions Classes/Service/ListService.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,11 @@
use TYPO3\CMS\Core\Database\ConnectionPool;
use TYPO3\CMS\Core\Database\RelationHandler;
use TYPO3\CMS\Core\Domain\Repository\PageRepository;
use TYPO3\CMS\Core\Information\Typo3Version;
use TYPO3\CMS\Core\Resource\FileRepository;
use TYPO3\CMS\Core\SingletonInterface;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Core\Versioning\VersionState;

class ListService implements SingletonInterface
class ListService
{
private const TABLE = 'tx_listelements_item';

Expand Down Expand Up @@ -79,9 +77,6 @@ public function resolveListitems(array $row, string $field = 'tx_listelements_li

protected function isDeletePlaceHolder(array $item): bool
{
if (GeneralUtility::makeInstance(Typo3Version::class)->getMajorVersion() < 13) {
return VersionState::cast($item['t3ver_state'] ?? 0)->equals(VersionState::DELETE_PLACEHOLDER);
}
return VersionState::tryFrom($item['t3ver_state'] ?? 0) === VersionState::DELETE_PLACEHOLDER;
}

Expand All @@ -91,18 +86,14 @@ public function resolveItemsForFrontend(int $uid, string $table = 'tt_content',
$pageRepository = GeneralUtility::makeInstance(PageRepository::class);
$relationHandler = GeneralUtility::makeInstance(RelationHandler::class);
$relationHandler->setWorkspaceId($workspaceId);
if (GeneralUtility::makeInstance(Typo3Version::class)->getMajorVersion() < 13) {
$additionalWhere = $pageRepository->enableFields(self::TABLE);
$constraints = $pageRepository->getDefaultConstraints(self::TABLE);
if ($constraints === []) {
$additionalWhere = '';
} else {
$constraints = $pageRepository->getDefaultConstraints(self::TABLE);
if ($constraints === []) {
$additionalWhere = '';
} else {
$expressionBuilder = GeneralUtility::makeInstance(ConnectionPool::class)
->getQueryBuilderForTable($table)
->expr();
$additionalWhere = ' AND ' . $expressionBuilder->and(...$constraints);
}
$expressionBuilder = GeneralUtility::makeInstance(ConnectionPool::class)
->getQueryBuilderForTable($table)
->expr();
$additionalWhere = ' AND ' . $expressionBuilder->and(...$constraints);
}
$relationHandler->additionalWhere[self::TABLE] = $additionalWhere;
$relationHandler->start(
Expand Down
10 changes: 0 additions & 10 deletions Configuration/Services.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,3 @@ services:

B13\Listelements\:
resource: '../Classes/*'

B13\Listelements\Hooks\DrawItem:
public: true
B13\Listelements\DataProcessing\ListItemsDataProcessor:
public: true
B13\Listelements\Listener\PageContentPreviewRendering:
tags:
- name: event.listener
event: TYPO3\CMS\Backend\View\Event\PageContentPreviewRenderingEvent
identifier: 'b13-listelements-page-content-preview-rendering'
2 changes: 2 additions & 0 deletions Configuration/Sets/listelements/setup.typoscript
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,5 @@ lib.contentElement {
}
}
}

# not required if you use record-transformation dataProcessing, s. README.md
5 changes: 0 additions & 5 deletions Configuration/TCA/Overrides/sys_template.php

This file was deleted.

89 changes: 8 additions & 81 deletions Configuration/TCA/Overrides/tx_listelements_item.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,87 +3,14 @@
defined('TYPO3') or die();

(function () {
$childTcaTypes = [
0 => [
'showitem' => '
--palette--;;basicoverlayPalette,
--palette--;;filePalette',
],
(enum_exists(\TYPO3\CMS\Core\Resource\FileType::class) ? \TYPO3\CMS\Core\Resource\FileType::TEXT->value : \TYPO3\CMS\Core\Resource\File::FILETYPE_TEXT) => [
'showitem' => '
--palette--;;imageoverlayPalette,
--palette--;;filePalette',
],
(enum_exists(\TYPO3\CMS\Core\Resource\FileType::class) ? \TYPO3\CMS\Core\Resource\FileType::IMAGE->value : \TYPO3\CMS\Core\Resource\File::FILETYPE_IMAGE) => [
'showitem' => '
--palette--;;imageoverlayPalette,
--palette--;;filePalette',
],
(enum_exists(\TYPO3\CMS\Core\Resource\FileType::class) ? \TYPO3\CMS\Core\Resource\FileType::AUDIO->value : \TYPO3\CMS\Core\Resource\File::FILETYPE_AUDIO) => [
'showitem' => '
--palette--;;audioOverlayPalette,
--palette--;;filePalette',
],
(enum_exists(\TYPO3\CMS\Core\Resource\FileType::class) ? \TYPO3\CMS\Core\Resource\FileType::VIDEO->value : \TYPO3\CMS\Core\Resource\File::FILETYPE_VIDEO) => [
'showitem' => '
--palette--;;videoOverlayPalette,
--palette--;;filePalette',
],
(enum_exists(\TYPO3\CMS\Core\Resource\FileType::class) ? \TYPO3\CMS\Core\Resource\FileType::APPLICATION->value : \TYPO3\CMS\Core\Resource\File::FILETYPE_APPLICATION) => [
'showitem' => '
--palette--;;basicoverlayPalette,
--palette--;;filePalette',
],
];
if ((\TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Core\Information\Typo3Version::class))->getMajorVersion() < 12) {
$GLOBALS['TCA']['tx_listelements_item']['ctrl']['cruser_id'] = 'cruser_id';
$GLOBALS['TCA']['tx_listelements_item']['columns']['l10n_parent']['config']['internal_type'] = 'db';
$GLOBALS['TCA']['tx_listelements_item']['columns']['sorting_foreign']['config']['type'] = 'input';
$GLOBALS['TCA']['tx_listelements_item']['columns']['sorting_foreign']['config']['eval'] = 'int';
$GLOBALS['TCA']['tx_listelements_item']['columns']['sorting_foreign']['config']['internal_type'] = 'db';
$GLOBALS['TCA']['tx_listelements_item']['columns']['images']['config'] = \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::getFileFieldTCAConfig(
'images',
[
'appearance' => [
'createNewRelationLinkTitle' => 'LLL:EXT:listelements/Resources/Private/Language/locallang_db.xlf:tx_listelements_item.images.addFileReference',
],
// custom configuration for displaying fields in the overlay/reference table
// to use the imageoverlayPalette instead of the basicoverlayPalette
'overrideChildTca' => [
'types' => $childTcaTypes,
],
]
);
$GLOBALS['TCA']['tx_listelements_item']['columns']['assets']['config'] = \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::getFileFieldTCAConfig(
'assets',
[
'appearance' => [
'createNewRelationLinkTitle' => 'LLL:EXT:listelements/Resources/Private/Language/locallang_db.xlf:tx_listelements_item.assets.addFileReference',
],
// custom configuration for displaying fields in the overlay/reference table
// to use the imageoverlayPalette instead of the basicoverlayPalette
'overrideChildTca' => [
'types' => $childTcaTypes,
],
]
);
$GLOBALS['TCA']['tx_listelements_item']['columns']['link']['config'] = [
'type' => 'input',
'renderType' => 'inputLink',
'size' => 50,
'max' => 1024,
'eval' => 'trim',
'fieldControl' => [
'linkPopup' => [
'options' => [
'title' => 'LLL:EXT:listelements/Resources/Private/Language/locallang_db.xlf:tx_listelements_item.link',
],
],
],
'softref' => 'typolink',
];
$majorVersion = (new \TYPO3\CMS\Core\Information\Typo3Version())->getMajorVersion();
if ($majorVersion < 14) {
$GLOBALS['TCA']['tx_listelements_item']['ctrl']['searchFields'] = 'header,subheader,bodytext,link';
} else {
$GLOBALS['TCA']['tx_listelements_item']['columns']['assets']['config']['overrideChildTca']['types'] = $childTcaTypes;
$GLOBALS['TCA']['tx_listelements_item']['columns']['images']['config']['overrideChildTca']['types'] = $childTcaTypes;
// https://docs.typo3.org/c/typo3/cms-core/main/en-us/Changelog/14.0/Breaking-106972-TCAControlOptionSearchFieldsRemoved.html
// the Schema API detects searchable fields (e.g. all type text or input
// we exclude:
$GLOBALS['TCA']['tx_listelements_item']['columns']['tablename']['config']['searchable'] = false;
$GLOBALS['TCA']['tx_listelements_item']['columns']['fieldname']['config']['searchable'] = false;
}
})();
Loading