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
9 changes: 9 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,4 @@
/Documentation export-ignore
/Tests export-ignore
/.* export-ignore
/Makefile export-ignore
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/bug-report.md
Original file line number Diff line number Diff line change
Expand Up @@ -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?
Expand Down
2 changes: 1 addition & 1 deletion .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@
/.php-cs-fixer.cache
/composer.lock
/release.sh
/Documentation-GENERATED-temp/
4 changes: 2 additions & 2 deletions Build/bin/console
Original file line number Diff line number Diff line change
Expand Up @@ -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());
10 changes: 7 additions & 3 deletions Build/fractor/fractor.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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,
]);
10 changes: 7 additions & 3 deletions Build/rector/rector.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -41,20 +42,23 @@
// 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([
AddVoidReturnTypeWhereNoReturnRector::class,
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',
],
]);
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<?php

declare(strict_types=1);

/*
* This file is part of the TYPO3 CMS project.
*
* (c) Simon Schaufelberger
*
* It is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, either version 2
* of the License, or any later version.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* The TYPO3 project - inspiring people to share!
*/

namespace SimonSchaufi\LockElement\EventListener;

use TYPO3\CMS\Backend\View\Event\ModifyDatabaseQueryForRecordListingEvent;
use TYPO3\CMS\Core\Attribute\AsEventListener;

#[AsEventListener(identifier: 'lock-element/modify-database-query-for-record-listing')]
final class ModifyDatabaseQueryForRecordListingEventListener
{
public function __invoke(ModifyDatabaseQueryForRecordListingEvent $event): void
{
if ($event->getTable() !== 'tt_content') {
return;
}

if (($event->getFields()[0] ?? null) === '*') {
return;
}

$queryBuilder = $event->getQueryBuilder();
$queryBuilder->addSelect('tx_lockelement_locked');
$event->setQueryBuilder($queryBuilder);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
<?php

declare(strict_types=1);

/*
* This file is part of the TYPO3 CMS project.
*
* (c) Simon Schaufelberger
*
* It is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, either version 2
* of the License, or any later version.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* The TYPO3 project - inspiring people to share!
*/

namespace SimonSchaufi\LockElement\EventListener;

use Psr\Container\ContainerExceptionInterface;
use Psr\Container\NotFoundExceptionInterface;
use TYPO3\CMS\Backend\RecordList\Event\ModifyRecordListRecordActionsEvent;
use TYPO3\CMS\Backend\Template\Components\ActionGroup;
use TYPO3\CMS\Core\Attribute\AsEventListener;
use TYPO3\CMS\Core\Domain\RawRecord;

#[AsEventListener(identifier: 'lock-element/modify-record-list-record-actions')]
final class ModifyRecordListRecordActionsEventListener
{
/**
* @throws ContainerExceptionInterface
* @throws NotFoundExceptionInterface
*/
public function __invoke(ModifyRecordListRecordActionsEvent $event): void
{
$record = $event->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);
}
}
}
8 changes: 8 additions & 0 deletions Configuration/Services.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
services:
_defaults:
autowire: true
autoconfigure: true
public: false

SimonSchaufi\LockElement\:
resource: '../Classes/*'
4 changes: 0 additions & 4 deletions Documentation/Changelog/0-0-1.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
.. include:: ../Includes.txt

.. only:: html

=====
0.0.1
=====
Expand Down
4 changes: 0 additions & 4 deletions Documentation/Changelog/1-0-0.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
.. include:: ../Includes.txt

.. only:: html

=====
1.0.0
=====
Expand Down
4 changes: 0 additions & 4 deletions Documentation/Changelog/1-0-1.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
.. include:: ../Includes.txt

.. only:: html

=====
1.0.1
=====
Expand Down
4 changes: 0 additions & 4 deletions Documentation/Changelog/2-0-0.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
.. include:: ../Includes.txt

.. only:: html

=====
2.0.0
=====
Expand Down
4 changes: 0 additions & 4 deletions Documentation/Changelog/2-0-1.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
.. include:: ../Includes.txt

.. only:: html

=====
2.0.1
=====
Expand Down
4 changes: 0 additions & 4 deletions Documentation/Changelog/2-0-3.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
.. include:: ../Includes.txt

.. only:: html

=====
2.0.3
=====
Expand Down
4 changes: 0 additions & 4 deletions Documentation/Changelog/2-1-0.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
.. include:: ../Includes.txt

.. only:: html

=====
2.1.0
=====
Expand Down
4 changes: 0 additions & 4 deletions Documentation/Changelog/2-1-1.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
.. include:: ../Includes.txt

.. only:: html

=====
2.1.1
=====
Expand Down
4 changes: 0 additions & 4 deletions Documentation/Changelog/2-1-2.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
.. include:: ../Includes.txt

.. only:: html

=====
2.1.2
=====
Expand Down
4 changes: 0 additions & 4 deletions Documentation/Changelog/2-2-0.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
.. include:: ../Includes.txt

.. only:: html

=====
2.2.0
=====
Expand Down
4 changes: 0 additions & 4 deletions Documentation/Changelog/3-0-0.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
.. include:: ../Includes.txt

.. only:: html

=====
3.0.0
=====
Expand Down
4 changes: 0 additions & 4 deletions Documentation/Changelog/4-0-0.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
.. include:: ../Includes.txt

.. only:: html

=====
4.0.0
=====
Expand Down
4 changes: 0 additions & 4 deletions Documentation/Changelog/5-0-0.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
.. include:: ../Includes.txt

.. only:: html

=====
5.0.0
=====
Expand Down
4 changes: 0 additions & 4 deletions Documentation/Changelog/6-0-0.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
.. include:: ../Includes.txt

.. only:: html

=====
6.0.0
=====
Expand Down
4 changes: 0 additions & 4 deletions Documentation/Changelog/6-0-1.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
.. include:: ../Includes.txt

.. only:: html

=====
6.0.1
=====
Expand Down
4 changes: 1 addition & 3 deletions Documentation/Changelog/Index.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
.. include:: ../Includes.txt

.. _changelog:

==========
Expand All @@ -17,4 +15,4 @@ List of versions
:reversed:
:glob:

*
*
13 changes: 0 additions & 13 deletions Documentation/Includes.txt

This file was deleted.

Loading
Loading