From cf5db800f90790a1f6f88f8d9267cdab1a3a87d2 Mon Sep 17 00:00:00 2001 From: Simon Schaufelberger Date: Thu, 30 Jul 2026 22:59:42 +0200 Subject: [PATCH] [FEATURE] TYPO3 14 compatibility --- .editorconfig | 9 ++ .gitattributes | 1 + .github/ISSUE_TEMPLATE/bug-report.md | 2 +- .github/PULL_REQUEST_TEMPLATE.md | 2 +- .gitignore | 1 + Build/bin/console | 4 +- Build/fractor/fractor.php | 10 +- Build/rector/rector.php | 10 +- ...baseQueryForRecordListingEventListener.php | 42 ++++++++ ...fyRecordListRecordActionsEventListener.php | 53 ++++++++++ Configuration/Services.yaml | 8 ++ Documentation/Changelog/0-0-1.rst | 4 - Documentation/Changelog/1-0-0.rst | 4 - Documentation/Changelog/1-0-1.rst | 4 - Documentation/Changelog/2-0-0.rst | 4 - Documentation/Changelog/2-0-1.rst | 4 - Documentation/Changelog/2-0-3.rst | 4 - Documentation/Changelog/2-1-0.rst | 4 - Documentation/Changelog/2-1-1.rst | 4 - Documentation/Changelog/2-1-2.rst | 4 - Documentation/Changelog/2-2-0.rst | 4 - Documentation/Changelog/3-0-0.rst | 4 - Documentation/Changelog/4-0-0.rst | 4 - Documentation/Changelog/5-0-0.rst | 4 - Documentation/Changelog/6-0-0.rst | 4 - Documentation/Changelog/6-0-1.rst | 4 - Documentation/Changelog/Index.rst | 4 +- Documentation/Includes.txt | 13 --- Documentation/Index.rst | 55 ++++------- Documentation/Installation/Index.rst | 2 - Documentation/Introduction/Index.rst | 2 - Documentation/Settings.cfg | 96 ------------------- Documentation/Sitemap.rst | 4 +- Documentation/guides.xml | 20 ++++ Makefile | 14 +++ README.md | 2 +- composer.json | 15 ++- ext_emconf.php | 2 +- ext_localconf.php | 2 + 39 files changed, 198 insertions(+), 235 deletions(-) create mode 100644 Classes/EventListener/ModifyDatabaseQueryForRecordListingEventListener.php create mode 100644 Classes/EventListener/ModifyRecordListRecordActionsEventListener.php create mode 100644 Configuration/Services.yaml delete mode 100644 Documentation/Includes.txt delete mode 100644 Documentation/Settings.cfg create mode 100644 Documentation/guides.xml create mode 100644 Makefile diff --git a/.editorconfig b/.editorconfig index 5a06f26..e11e4e6 100644 --- a/.editorconfig +++ b/.editorconfig @@ -21,6 +21,11 @@ indent_style = space # ReST files [{*.rst,*.rst.txt}] +charset = utf-8 +end_of_line = lf +insert_final_newline = true +trim_trailing_whitespace = true +indent_style = space indent_size = 4 max_line_length = 80 @@ -41,3 +46,7 @@ indent_style = tab [*.sql] indent_style = tab indent_size = 2 + +[Makefile] +# Use tabs for indentation (Makefiles require tabs) +indent_style = tab \ No newline at end of file diff --git a/.gitattributes b/.gitattributes index 9276800..cc64ae4 100644 --- a/.gitattributes +++ b/.gitattributes @@ -17,3 +17,4 @@ /Documentation export-ignore /Tests export-ignore /.* export-ignore +/Makefile export-ignore diff --git a/.github/ISSUE_TEMPLATE/bug-report.md b/.github/ISSUE_TEMPLATE/bug-report.md index f542da5..aee8b4b 100644 --- a/.github/ISSUE_TEMPLATE/bug-report.md +++ b/.github/ISSUE_TEMPLATE/bug-report.md @@ -11,8 +11,8 @@ assignees: '' ## Prerequisites -* [ ] Can you reproduce the problem on TYPO3 v12.4 LTS * [ ] Can you reproduce the problem on TYPO3 v13.4 LTS +* [ ] Can you reproduce the problem on TYPO3 v14.3 LTS * [ ] Can you reproduce the problem on TYPO3 dev-main * [ ] Did you [perform a search](https://github.com/simonschaufi/lock_element/issues) to see if your bug or enhancement is already reported? diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 5001cbc..6b1fcb8 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -8,7 +8,7 @@ ## Prerequisites -* [ ] Changes have been tested on TYPO3 v13.4 LTS +* [ ] Changes have been tested on TYPO3 v14.3 LTS * [ ] Changes have been tested on TYPO3 dev-main * [ ] Changes have been tested on PHP 8.x * [ ] Changes have been checked for CGL compliance `php-cs-fixer fix` diff --git a/.gitignore b/.gitignore index f59f8fb..a481629 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,4 @@ /.php-cs-fixer.cache /composer.lock /release.sh +/Documentation-GENERATED-temp/ diff --git a/Build/bin/console b/Build/bin/console index 54fe102..a315a2e 100644 --- a/Build/bin/console +++ b/Build/bin/console @@ -10,7 +10,7 @@ use Symfony\Component\Translation\Command\XliffLintCommand; use Symfony\Component\Yaml\Command\LintCommand; $application = new Application(); -$application->add(new XliffLintCommand(null, null, null, false)); -$application->add(new LintCommand()); +$application->addCommand(new XliffLintCommand(null, null, null, false)); +$application->addCommand(new LintCommand()); exit($application->run()); diff --git a/Build/fractor/fractor.php b/Build/fractor/fractor.php index 3c69c0d..5ea5be3 100644 --- a/Build/fractor/fractor.php +++ b/Build/fractor/fractor.php @@ -6,6 +6,7 @@ use a9f\Fractor\ValueObject\Indent; use a9f\FractorComposerJson\ChangePackageVersionComposerJsonFractor; use a9f\FractorComposerJson\ValueObject\PackageAndVersion; +use a9f\FractorXliff\XliffFileProcessor; use a9f\FractorXml\Configuration\XmlProcessorOption; use a9f\Typo3Fractor\Set\Typo3LevelSetList; @@ -20,16 +21,19 @@ __DIR__ . '/../../ext_localconf.php', ]) ->withSets([ - Typo3LevelSetList::UP_TO_TYPO3_13, + Typo3LevelSetList::UP_TO_TYPO3_14, ]) ->withConfiguredRule( ChangePackageVersionComposerJsonFractor::class, [ - new PackageAndVersion('typo3/cms-core', '^13.4'), - new PackageAndVersion('typo3/cms-backend', '^13.4'), + new PackageAndVersion('typo3/cms-core', '^14.3'), + new PackageAndVersion('typo3/cms-backend', '^14.3'), ] ) ->withOptions([ XmlProcessorOption::INDENT_CHARACTER => Indent::STYLE_TAB, XmlProcessorOption::INDENT_SIZE => 1, + ]) + ->withSkip([ + XliffFileProcessor::class, ]); diff --git a/Build/rector/rector.php b/Build/rector/rector.php index a91fede..bf94fbf 100644 --- a/Build/rector/rector.php +++ b/Build/rector/rector.php @@ -7,6 +7,7 @@ use Rector\Set\ValueObject\LevelSetList; use Rector\Set\ValueObject\SetList; use Rector\TypeDeclaration\Rector\ClassMethod\AddVoidReturnTypeWhereNoReturnRector; +use Rector\TypeDeclaration\Rector\StmtsAwareInterface\SafeDeclareStrictTypesRector; use Rector\ValueObject\PhpVersion; use Ssch\TYPO3Rector\CodeQuality\General\ConvertImplicitVariablesToExplicitGlobalsRector; use Ssch\TYPO3Rector\CodeQuality\General\ExtEmConfRector; @@ -41,7 +42,7 @@ // TYPO3 Sets Typo3SetList::CODE_QUALITY, Typo3SetList::GENERAL, - Typo3LevelSetList::UP_TO_TYPO3_13, + Typo3LevelSetList::UP_TO_TYPO3_14, ]); $rectorConfig->phpstanConfig(Typo3Option::PHPSTAN_FOR_RECTOR_PATH); $rectorConfig->rules([ @@ -49,12 +50,15 @@ ConvertImplicitVariablesToExplicitGlobalsRector::class, ]); $rectorConfig->ruleWithConfiguration(ExtEmConfRector::class, [ - ExtEmConfRector::PHP_VERSION_CONSTRAINT => '8.2.0-8.4.99', - ExtEmConfRector::TYPO3_VERSION_CONSTRAINT => '13.4.0-13.4.99', + ExtEmConfRector::PHP_VERSION_CONSTRAINT => '8.2.0-8.5.99', + ExtEmConfRector::TYPO3_VERSION_CONSTRAINT => '14.3.0-14.3.99', ExtEmConfRector::ADDITIONAL_VALUES_TO_BE_REMOVED => [], ]); $rectorConfig->importNames(); $rectorConfig->importShortClasses(false); $rectorConfig->skip([ + SafeDeclareStrictTypesRector::class => [ + __DIR__ . '/../../ext_emconf.php', + ], ]); }; diff --git a/Classes/EventListener/ModifyDatabaseQueryForRecordListingEventListener.php b/Classes/EventListener/ModifyDatabaseQueryForRecordListingEventListener.php new file mode 100644 index 0000000..667da43 --- /dev/null +++ b/Classes/EventListener/ModifyDatabaseQueryForRecordListingEventListener.php @@ -0,0 +1,42 @@ +getTable() !== 'tt_content') { + return; + } + + if (($event->getFields()[0] ?? null) === '*') { + return; + } + + $queryBuilder = $event->getQueryBuilder(); + $queryBuilder->addSelect('tx_lockelement_locked'); + $event->setQueryBuilder($queryBuilder); + } +} diff --git a/Classes/EventListener/ModifyRecordListRecordActionsEventListener.php b/Classes/EventListener/ModifyRecordListRecordActionsEventListener.php new file mode 100644 index 0000000..53fc596 --- /dev/null +++ b/Classes/EventListener/ModifyRecordListRecordActionsEventListener.php @@ -0,0 +1,53 @@ +getRecord(); + $rawRecord = $record->getRawRecord(); + if (! $rawRecord instanceof RawRecord) { + return; + } + + if (! $rawRecord->has('tx_lockelement_locked')) { + return; + } + + $locked = $rawRecord->get('tx_lockelement_locked'); + if ($locked) { + $event->removeAction('delete', ActionGroup::primary); + } + } +} diff --git a/Configuration/Services.yaml b/Configuration/Services.yaml new file mode 100644 index 0000000..1d600c0 --- /dev/null +++ b/Configuration/Services.yaml @@ -0,0 +1,8 @@ +services: + _defaults: + autowire: true + autoconfigure: true + public: false + + SimonSchaufi\LockElement\: + resource: '../Classes/*' diff --git a/Documentation/Changelog/0-0-1.rst b/Documentation/Changelog/0-0-1.rst index a66ccbb..648654c 100644 --- a/Documentation/Changelog/0-0-1.rst +++ b/Documentation/Changelog/0-0-1.rst @@ -1,7 +1,3 @@ -.. include:: ../Includes.txt - -.. only:: html - ===== 0.0.1 ===== diff --git a/Documentation/Changelog/1-0-0.rst b/Documentation/Changelog/1-0-0.rst index 21f943b..4ba7ce8 100644 --- a/Documentation/Changelog/1-0-0.rst +++ b/Documentation/Changelog/1-0-0.rst @@ -1,7 +1,3 @@ -.. include:: ../Includes.txt - -.. only:: html - ===== 1.0.0 ===== diff --git a/Documentation/Changelog/1-0-1.rst b/Documentation/Changelog/1-0-1.rst index b68a27d..b671f3a 100644 --- a/Documentation/Changelog/1-0-1.rst +++ b/Documentation/Changelog/1-0-1.rst @@ -1,7 +1,3 @@ -.. include:: ../Includes.txt - -.. only:: html - ===== 1.0.1 ===== diff --git a/Documentation/Changelog/2-0-0.rst b/Documentation/Changelog/2-0-0.rst index bc9eff1..093400a 100644 --- a/Documentation/Changelog/2-0-0.rst +++ b/Documentation/Changelog/2-0-0.rst @@ -1,7 +1,3 @@ -.. include:: ../Includes.txt - -.. only:: html - ===== 2.0.0 ===== diff --git a/Documentation/Changelog/2-0-1.rst b/Documentation/Changelog/2-0-1.rst index a9f7a2d..b6ae2b9 100644 --- a/Documentation/Changelog/2-0-1.rst +++ b/Documentation/Changelog/2-0-1.rst @@ -1,7 +1,3 @@ -.. include:: ../Includes.txt - -.. only:: html - ===== 2.0.1 ===== diff --git a/Documentation/Changelog/2-0-3.rst b/Documentation/Changelog/2-0-3.rst index 6a2312c..6768c1c 100644 --- a/Documentation/Changelog/2-0-3.rst +++ b/Documentation/Changelog/2-0-3.rst @@ -1,7 +1,3 @@ -.. include:: ../Includes.txt - -.. only:: html - ===== 2.0.3 ===== diff --git a/Documentation/Changelog/2-1-0.rst b/Documentation/Changelog/2-1-0.rst index 8effba6..fc33dc0 100644 --- a/Documentation/Changelog/2-1-0.rst +++ b/Documentation/Changelog/2-1-0.rst @@ -1,7 +1,3 @@ -.. include:: ../Includes.txt - -.. only:: html - ===== 2.1.0 ===== diff --git a/Documentation/Changelog/2-1-1.rst b/Documentation/Changelog/2-1-1.rst index 3aa0721..e4e891e 100644 --- a/Documentation/Changelog/2-1-1.rst +++ b/Documentation/Changelog/2-1-1.rst @@ -1,7 +1,3 @@ -.. include:: ../Includes.txt - -.. only:: html - ===== 2.1.1 ===== diff --git a/Documentation/Changelog/2-1-2.rst b/Documentation/Changelog/2-1-2.rst index fb8a1a7..f221740 100644 --- a/Documentation/Changelog/2-1-2.rst +++ b/Documentation/Changelog/2-1-2.rst @@ -1,7 +1,3 @@ -.. include:: ../Includes.txt - -.. only:: html - ===== 2.1.2 ===== diff --git a/Documentation/Changelog/2-2-0.rst b/Documentation/Changelog/2-2-0.rst index e79a0d3..1e17f21 100644 --- a/Documentation/Changelog/2-2-0.rst +++ b/Documentation/Changelog/2-2-0.rst @@ -1,7 +1,3 @@ -.. include:: ../Includes.txt - -.. only:: html - ===== 2.2.0 ===== diff --git a/Documentation/Changelog/3-0-0.rst b/Documentation/Changelog/3-0-0.rst index 196dcce..4ad5a5f 100644 --- a/Documentation/Changelog/3-0-0.rst +++ b/Documentation/Changelog/3-0-0.rst @@ -1,7 +1,3 @@ -.. include:: ../Includes.txt - -.. only:: html - ===== 3.0.0 ===== diff --git a/Documentation/Changelog/4-0-0.rst b/Documentation/Changelog/4-0-0.rst index 9d3746a..918a2e8 100644 --- a/Documentation/Changelog/4-0-0.rst +++ b/Documentation/Changelog/4-0-0.rst @@ -1,7 +1,3 @@ -.. include:: ../Includes.txt - -.. only:: html - ===== 4.0.0 ===== diff --git a/Documentation/Changelog/5-0-0.rst b/Documentation/Changelog/5-0-0.rst index 74539e7..c4863a2 100644 --- a/Documentation/Changelog/5-0-0.rst +++ b/Documentation/Changelog/5-0-0.rst @@ -1,7 +1,3 @@ -.. include:: ../Includes.txt - -.. only:: html - ===== 5.0.0 ===== diff --git a/Documentation/Changelog/6-0-0.rst b/Documentation/Changelog/6-0-0.rst index cff78a2..0815574 100644 --- a/Documentation/Changelog/6-0-0.rst +++ b/Documentation/Changelog/6-0-0.rst @@ -1,7 +1,3 @@ -.. include:: ../Includes.txt - -.. only:: html - ===== 6.0.0 ===== diff --git a/Documentation/Changelog/6-0-1.rst b/Documentation/Changelog/6-0-1.rst index 14c6f93..b326cb2 100644 --- a/Documentation/Changelog/6-0-1.rst +++ b/Documentation/Changelog/6-0-1.rst @@ -1,7 +1,3 @@ -.. include:: ../Includes.txt - -.. only:: html - ===== 6.0.1 ===== diff --git a/Documentation/Changelog/Index.rst b/Documentation/Changelog/Index.rst index 8e258fa..606cdb1 100644 --- a/Documentation/Changelog/Index.rst +++ b/Documentation/Changelog/Index.rst @@ -1,5 +1,3 @@ -.. include:: ../Includes.txt - .. _changelog: ========== @@ -17,4 +15,4 @@ List of versions :reversed: :glob: - * + * diff --git a/Documentation/Includes.txt b/Documentation/Includes.txt deleted file mode 100644 index f57469d..0000000 --- a/Documentation/Includes.txt +++ /dev/null @@ -1,13 +0,0 @@ -.. This is 'Includes.txt'. It is included at the very top of each and - every ReST source file in THIS documentation project (= manual). - -.. role:: aspect (emphasis) -.. role:: html(code) -.. role:: js(code) -.. role:: php(code) -.. role:: sep (strong) -.. role:: sql(code) -.. role:: yaml(code) - -.. default-role:: code -.. highlight:: php diff --git a/Documentation/Index.rst b/Documentation/Index.rst index ce46179..02ae2e8 100644 --- a/Documentation/Index.rst +++ b/Documentation/Index.rst @@ -1,17 +1,15 @@ -.. every .rst file should include Includes.txt -.. use correct path! - -.. include:: Includes.txt - -.. Every manual should have a start label for cross-referencing to -.. start page. Do not remove this! - .. _start: ============ Lock element ============ +:Extension key: + lock_element + +:Package name: + simonschaufi/lock-element + :Version: |release| @@ -21,47 +19,30 @@ Lock element :Authors: Simon Schaufelberger -:Email: - simonschaufi+lockelement [at] gmail [dot] com - :License: - This extension documentation is published under the - `CC BY-NC-SA 4.0 `__ (Creative Commons) - license - -This extension makes it possible for TYPO3 backend users to lock single pages or content records from being deleted. - -**TYPO3** - -The content of this document is related to TYPO3 CMS, -a GNU/GPL CMS/Framework available from `typo3.org `_ . + This document is published under the + `Open Publication License `__. -**Community Documentation** +---- -This documentation is community documentation for the TYPO3 extension Lock Element. - -It is maintained as part of this third party extension. - -If you find an error or something is missing, please: -`Report a Problem `__ - -**Extension Manual** - -This documentation is for the TYPO3 extension lock_element. - -**For Contributors** +This extension makes it possible for TYPO3 backend users to lock single pages or content records from being deleted. -You are welcome to help improve this guide. -Just click on "Edit me on GitHub" on the top right to submit your change request. +---- **Table of Contents** .. toctree:: - :maxdepth: 3 + :maxdepth: 2 :titlesonly: :glob: Introduction/Index Installation/Index Changelog/Index + +.. Meta Menu + +.. toctree:: + :hidden: + Sitemap diff --git a/Documentation/Installation/Index.rst b/Documentation/Installation/Index.rst index 433bc0e..1729a17 100644 --- a/Documentation/Installation/Index.rst +++ b/Documentation/Installation/Index.rst @@ -1,5 +1,3 @@ -.. include:: ../Includes.txt - .. _installation: Installation diff --git a/Documentation/Introduction/Index.rst b/Documentation/Introduction/Index.rst index cf71031..f248736 100644 --- a/Documentation/Introduction/Index.rst +++ b/Documentation/Introduction/Index.rst @@ -1,5 +1,3 @@ -.. include:: ../Includes.txt - .. _introduction: ============ diff --git a/Documentation/Settings.cfg b/Documentation/Settings.cfg deleted file mode 100644 index 95e4bba..0000000 --- a/Documentation/Settings.cfg +++ /dev/null @@ -1,96 +0,0 @@ -# ##### -# -# Settings.cfg - A TYPO3 Documentation Project's Configuration File -# Information about Settings.cfg: -# https://docs.typo3.org/m/typo3/docs-how-to-document/master/en-us/GeneralConventions/DirectoryFilenames.html#settings-cfg -# -# About Syntax: -# See https://docs.python.org/2/library/configparser.html -# -# Attention: -# Only " ;" can start an inline comment. -# This is: blank PLUS semicolon! -# -# ##### - -[general] - -# ................................................................................. -# ... (required) title (displayed in left sidebar (desktop) or top panel (mobile) -# ................................................................................. - -project = Lock element - -# ................................................................................. -# ... (recommended) version, displayed next to title (desktop) and in + + + + + diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..7732828 --- /dev/null +++ b/Makefile @@ -0,0 +1,14 @@ +.PHONY: help +help: ## Displays this list of targets with descriptions + @echo "The following commands are available:\n" + @grep -E '^[a-zA-Z0-9_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[32m%-30s\033[0m %s\n", $$1, $$2}' + +.PHONY: docs +docs: ## Generate projects docs (from "Documentation" directory) + mkdir -p Documentation-GENERATED-temp + docker run --rm --pull always -v "$(shell pwd)":/project -t ghcr.io/typo3-documentation/render-guides:latest --config=Documentation + +.PHONY: test-docs +test-docs: ## Test the documentation rendering + mkdir -p Documentation-GENERATED-temp + docker run --rm --pull always -v "$(shell pwd)":/project -t ghcr.io/typo3-documentation/render-guides:latest --config=Documentation --no-progress --minimal-test diff --git a/README.md b/README.md index fd9b23a..60d0fb0 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ [![Latest Stable Version](https://poser.pugx.org/simonschaufi/lock-element/v/stable)](https://packagist.org/packages/simonschaufi/lock-element) [![Total Downloads](https://poser.pugx.org/simonschaufi/lock-element/downloads)](https://packagist.org/packages/simonschaufi/lock-element) [![License](https://poser.pugx.org/simonschaufi/lock-element/license)](https://packagist.org/packages/simonschaufi/lock-element) -[![TYPO3](https://img.shields.io/badge/TYPO3-13-orange.svg)](https://get.typo3.org/version/13) +[![TYPO3](https://img.shields.io/badge/TYPO3-14-orange.svg)](https://get.typo3.org/version/14) This extension makes it possible for TYPO3 backend users to lock single pages or content records from being deleted. diff --git a/composer.json b/composer.json index e78e269..8330883 100755 --- a/composer.json +++ b/composer.json @@ -8,19 +8,18 @@ ], "require": { "php": "^8.2", - "typo3/cms-backend": "^13.4", - "typo3/cms-core": "^13.4" + "typo3/cms-backend": "^14.3", + "typo3/cms-core": "^14.3" }, "require-dev": { - "a9f/fractor-composer-json": "^0.5.0", - "a9f/typo3-fractor": "^0.5.0", + "a9f/fractor-composer-json": "^1.0", + "a9f/typo3-fractor": "^1.0", "ergebnis/composer-normalize": "^2.47", "ssch/typo3-rector": "^3.3.0", "symfony/translation": "^7.1.3", - "symplify/easy-coding-standard": "^12.5" - }, - "replace": { - "typo3-ter/lock-element": "self.version" + "symplify/easy-coding-standard": "^12.5", + "typo3/cms-frontend": "^14.3", + "typo3/cms-install": "^14.3" }, "autoload": { "psr-4": { diff --git a/ext_emconf.php b/ext_emconf.php index e2f461b..6122791 100755 --- a/ext_emconf.php +++ b/ext_emconf.php @@ -11,7 +11,7 @@ 'author_company' => '', 'constraints' => [ 'depends' => [ - 'typo3' => '13.4.0-13.4.99', + 'typo3' => '14.3.0-14.3.99', ], 'conflicts' => [], 'suggests' => [], diff --git a/ext_localconf.php b/ext_localconf.php index 1badba5..661ba16 100644 --- a/ext_localconf.php +++ b/ext_localconf.php @@ -1,5 +1,7 @@