forked from wazum/sluggi
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Do not update child pages when parent page has slug_locked=1
Relates: wazum#112
- Loading branch information
Christoph Lehmann
committed
Nov 23, 2024
1 parent
8382d2e
commit a503c7c
Showing
2 changed files
with
82 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Wazum\Sluggi\Database; | ||
|
||
use TYPO3\CMS\Core\Database\Query\Expression\CompositeExpression; | ||
use TYPO3\CMS\Core\Database\Query\Expression\ExpressionBuilder; | ||
use TYPO3\CMS\Core\Database\Query\Restriction\QueryRestrictionInterface; | ||
|
||
class SlugUnlockedRestriction implements QueryRestrictionInterface | ||
{ | ||
public function buildExpression(array $queriedTables, ExpressionBuilder $expressionBuilder): CompositeExpression | ||
{ | ||
$constraints = []; | ||
foreach ($queriedTables as $tableAlias => $tableName) { | ||
if ($tableName === 'pages') { | ||
$constraints[] = $expressionBuilder->eq( | ||
$tableAlias . '.' . 'slug_locked', | ||
0 | ||
); | ||
} | ||
} | ||
return $expressionBuilder->and(...$constraints); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters