Skip to content

Commit

Permalink
[BUGFIX] Avoid unacceptable slug changes on locked slugs
Browse files Browse the repository at this point in the history
EXT:sluggi always(on each pages change) rewrites the slug with path segments to the last path segment,
even the slug is locked and not changed by editor.
Also from `/virtual-parent-slug/my-test-page` to `/my-test-page`.
This change prevents overrides on slugs at least on "locked" slugs.

**Note: This is a partial fix only and not locked slugs will be still overridden.**

Relates: wazum#98
  • Loading branch information
dkd-kaehm committed Oct 30, 2023
1 parent b2c353e commit b4587f5
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Classes/Backend/Form/InputSlugElement.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ private function updateUiForRestrictedAccess(array $result): array
if (!empty($inaccessibleSlugSegments) && 0 === strncmp($editableSlugSegments, $inaccessibleSlugSegments, strlen($inaccessibleSlugSegments))) {
$editableSlugSegments = substr($editableSlugSegments, strlen($inaccessibleSlugSegments));
}
if ($allowOnlyLastSegment && !empty($editableSlugSegments)) {
if ($allowOnlyLastSegment && !($this->data['databaseRow']['slug_locked']) && !empty($editableSlugSegments)) {
$segments = explode('/', $editableSlugSegments);
$editableSlugSegments = '/' . array_pop($segments);
$prefix .= implode('/', $segments);
Expand Down
2 changes: 1 addition & 1 deletion Classes/DataHandler/HandlePageUpdate.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public function processDatamap_preProcessFieldArray(

if ($this->shouldSynchronize($pageRecord, $fields)) {
$fields = $this->synchronize($pageRecord, $fields);
} elseif ($this->isManualUpdateWithOnlyLastSegmentAllowed($fields)) {
} elseif ($this->isManualUpdateWithOnlyLastSegmentAllowed($fields) && !($pageRecord['slug_locked'])) {
$fields = $this->updateLastSegment($pageRecord, $fields);
}
}
Expand Down

0 comments on commit b4587f5

Please sign in to comment.