Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TYPO3 v13 compatibility #22

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
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
6 changes: 3 additions & 3 deletions Classes/Hooks/DataHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,14 @@ public function processDatamap_beforeStart(\TYPO3\CMS\Core\DataHandling\DataHand
}
}

public function processCmdmap_preProcess($command, $table, $id, $value, $pObj, $pasteUpdate)
public function processCmdmap_preProcess($command, $table, $id, $value, $pObj, $pasteUpdate): void
{
if (in_array($command, ['copy', 'localize']) && $table === 'tt_content') {
$GLOBALS['TCA']['tt_content']['columns']['tx_t23inlinecontainer_elements']['config']['type'] = 'none';
}
}

public function processCmdmap_postProcess($command, $table, $id, $value, $pObj, $pasteUpdate, $pasteDatamap)
public function processCmdmap_postProcess($command, $table, $id, $value, $pObj, $pasteUpdate, $pasteDatamap): void
{
if (in_array($command, ['copy', 'localize']) && $table === 'tt_content') {
$GLOBALS['TCA']['tt_content']['columns']['tx_t23inlinecontainer_elements']['config']['type'] = 'tx_t23inlinecontainer_elements';
Expand All @@ -60,7 +60,7 @@ public function processCmdmap_postProcess($command, $table, $id, $value, $pObj,
* @param \TYPO3\CMS\Core\DataHandling\DataHandler $dataHandler
* @return void
*/
public function processDatamap_afterAllOperations(\TYPO3\CMS\Core\DataHandling\DataHandler $dataHandler)
public function processDatamap_afterAllOperations(\TYPO3\CMS\Core\DataHandling\DataHandler $dataHandler): void
{
// Make sure that container sorting is only update once per container element
// => Only run sorting update after all operations have been finished
Expand Down
2 changes: 1 addition & 1 deletion Classes/Integrity/Sorting.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

class Sorting extends \B13\Container\Integrity\Sorting
{
public function runForSingleContainer($containerRecord, $cType)
public function runForSingleContainer($containerRecord, $cType): void
{
$columns = $this->tcaRegistry->getAvailableColumns($cType);
$colPosByCType[$cType] = [];
Expand Down
2 changes: 1 addition & 1 deletion Classes/Listener/AddFieldToAllContainers.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
use TYPO3\CMS\Core\Utility\GeneralUtility;

class AddFieldToAllContainers {
public function __invoke(AfterTcaCompilationEvent $event)
public function __invoke(AfterTcaCompilationEvent $event): void
{
$containerRegistry = GeneralUtility::makeInstance(\B13\Container\Tca\Registry::class);

Expand Down
52 changes: 52 additions & 0 deletions Classes/Listener/ContentUsedOnPage.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
<?php

declare(strict_types=1);

namespace Team23\T23InlineContainer\Listener;

use B13\Container\Domain\Factory\Exception;
use B13\Container\Domain\Factory\PageView\Backend\ContainerFactory;
use B13\Container\Tca\Registry;
use TYPO3\CMS\Backend\View\Event\IsContentUsedOnPageLayoutEvent;

final class ContentUsedOnPage
{
protected Registry $tcaRegistry;
protected ContainerFactory $containerFactory;

public function __construct(ContainerFactory $containerFactory, Registry $tcaRegistry)
{
$this->containerFactory = $containerFactory;
$this->tcaRegistry = $tcaRegistry;
}

public function __invoke(IsContentUsedOnPageLayoutEvent $event): void
{
$record = $event->getRecord();
if ($record['tx_container_parent'] > 0) {
try {
$container = $this->containerFactory->buildContainer((int)$record['tx_container_parent']);
$columns = $this->tcaRegistry->getAvailableColumns($container->getCType());
foreach ($columns as $column) {
if ($column['colPos'] === (int)$record['colPos']) {
if ($record['sys_language_uid'] > 0 && $container->isConnectedMode()) {

/*
Prevents displaying of "Unused elements detected on this page" in the Page module in Backend when
container element is translated in "Connected Mode"
*/
$used = ($container->hasChildInColPos((int)$record['colPos'], (int)$record['l18n_parent'])
|| $container->hasChildInColPos((int)$record['colPos'], (int)$record['uid']));
$event->setUsed($used);
return;
}
$used = $container->hasChildInColPos((int)$record['colPos'], (int)$record['uid']);
$event->setUsed($used);
return;
}
}
} catch (Exception $e) {
}
}
}
}
8 changes: 7 additions & 1 deletion Configuration/Services.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,10 @@ services:
tags:
- name: event.listener
identifier: 'addFieldToAllContainers'
event: TYPO3\CMS\Core\Configuration\Event\AfterTcaCompilationEvent
event: TYPO3\CMS\Core\Configuration\Event\AfterTcaCompilationEvent

Team23\T23InlineContainer\Listener\ContentUsedOnPage:
tags:
- name: event.listener
identifier: 't23-inline-container-content-used-on-page'
after: 'tx-container-content-used-on-page'
1 change: 0 additions & 1 deletion Configuration/TCA/Overrides/tt_content.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
'levelLinksPosition' => 'bottom',
'useSortable' => true,
'showPossibleLocalizationRecords' => true,
'showRemovedLocalizationRecords' => true,
'showAllLocalizationLink' => true,
'showSynchronizationLink' => true,
'enabledControls' => [
Expand Down
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
"homepage": "https://www.team23.de/",
"license": "GPL-2.0-or-later",
"require": {
"typo3/cms-core": "^11.5 || ^12.4",
"b13/container": "^2.3.1"
"typo3/cms-core": "^12.4 || ^13.4",
"b13/container": "^2.3 || ^3.1"
},
"suggest": {
"georgringer/news": "Most usefull application of this extension."
Expand Down
9 changes: 4 additions & 5 deletions ext_emconf.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,16 @@
'author_email' => '[email protected]',
'author_company' => 'TEAM23',
'state' => 'beta',
'clearCacheOnLoad' => true,
'version' => '0.0.13',
'version' => '1.0.0',
'constraints' => [
'depends' => [
'typo3' => '11.0.0-12.9.99',
'container' => '2.3.1-2.9.99',
'typo3' => '12.4.0-13.4.99',
'container' => '2.3.1-3.9.99',
],
'conflicts' => [
],
'suggests' => [
'news' => '9.0.0-10.9.9'
'news' => '9.0.0-12.9.9'
],
],
];