Skip to content

Commit

Permalink
[FEATURE] tx_realurl_pathoverride also used for urls of subpages
Browse files Browse the repository at this point in the history
if tx_realurl_pathoverride is set, the url the the very page where it is set is reduced to the value given in tx_realurl_pathsegment. However urls to subpages are still generated with the full url, ignoring tx_realurl_pathoverride. This commit changes that. Also subpages start with the short path given in tx_realurl_pathsegment. 
The UrlDecoder already can handle these urls correctly.
  • Loading branch information
franzkugelmann authored Jul 27, 2016
1 parent 816f593 commit be25dc1
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion Classes/Encoder/UrlEncoder.php
Original file line number Diff line number Diff line change
Expand Up @@ -483,20 +483,30 @@ protected function createPathComponentUsingRootline() {
unset($overlay);
}
}
// if pathoverride is set, use pathsegment also for all subpages to shorten the url and throw away all segments found so far
if ($page['tx_realurl_pathoverride'] && !empty($page['tx_realurl_pathsegment'])) {
$segment = $this->utility->convertToSafeString(trim($page['tx_realurl_pathsegment'], '/'), $this->separatorCharacter);
$components = array($segment);
continue;
}


foreach (self::$pageTitleFields as $field) {
if (isset($page[$field]) && $page[$field] !== '') {
$segment = $this->utility->convertToSafeString($page[$field], $this->separatorCharacter);
if ($segment === '') {
$segment = $this->emptySegmentValue;
}
$components[] = $segment;
$this->appendToEncodedUrl($segment);
continue 2;
}
}
}

if (count($components) > 0) {
foreach ($components as $segment) {
$this->appendToEncodedUrl($segment);
}
$this->addToPathCache(implode('/', $components));
}
}
Expand Down

0 comments on commit be25dc1

Please sign in to comment.