diff --git a/Classes/Hooks/DataHandler.php b/Classes/Hooks/DataHandler.php index a5743a9..87019a1 100644 --- a/Classes/Hooks/DataHandler.php +++ b/Classes/Hooks/DataHandler.php @@ -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'; @@ -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 diff --git a/Classes/Integrity/Sorting.php b/Classes/Integrity/Sorting.php index 81dd37d..834a6d6 100644 --- a/Classes/Integrity/Sorting.php +++ b/Classes/Integrity/Sorting.php @@ -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] = []; diff --git a/Classes/Listener/AddFieldToAllContainers.php b/Classes/Listener/AddFieldToAllContainers.php index 9cae455..df57948 100644 --- a/Classes/Listener/AddFieldToAllContainers.php +++ b/Classes/Listener/AddFieldToAllContainers.php @@ -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); diff --git a/Classes/Listener/ContentUsedOnPage.php b/Classes/Listener/ContentUsedOnPage.php new file mode 100644 index 0000000..91715cb --- /dev/null +++ b/Classes/Listener/ContentUsedOnPage.php @@ -0,0 +1,52 @@ +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) { + } + } + } +} \ No newline at end of file diff --git a/Configuration/Services.yaml b/Configuration/Services.yaml index 1e6f076..a364d62 100644 --- a/Configuration/Services.yaml +++ b/Configuration/Services.yaml @@ -15,4 +15,10 @@ services: tags: - name: event.listener identifier: 'addFieldToAllContainers' - event: TYPO3\CMS\Core\Configuration\Event\AfterTcaCompilationEvent \ No newline at end of file + 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' \ No newline at end of file diff --git a/Configuration/TCA/Overrides/tt_content.php b/Configuration/TCA/Overrides/tt_content.php index 81534d0..c2d180d 100644 --- a/Configuration/TCA/Overrides/tt_content.php +++ b/Configuration/TCA/Overrides/tt_content.php @@ -27,7 +27,6 @@ 'levelLinksPosition' => 'bottom', 'useSortable' => true, 'showPossibleLocalizationRecords' => true, - 'showRemovedLocalizationRecords' => true, 'showAllLocalizationLink' => true, 'showSynchronizationLink' => true, 'enabledControls' => [ diff --git a/composer.json b/composer.json index cc478d1..59d23da 100644 --- a/composer.json +++ b/composer.json @@ -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." diff --git a/ext_emconf.php b/ext_emconf.php index bf9390d..b40b07f 100644 --- a/ext_emconf.php +++ b/ext_emconf.php @@ -15,17 +15,16 @@ 'author_email' => 'dreier@team23.de', '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' ], ], ];