My solution ensures that in the "strReplaceFirst" function it specifically searches for a URL alias that starts with a part instead of the first occurring part in the URL.
private function strReplaceFirst(string $search, string $replace, string $subject) {
if(str_starts_with($subject, $search)) {
$pos = strpos($subject, $search);
if ($pos !== false) {
return substr_replace($subject, $replace, $pos, strlen($search));
}
}
return $subject;
}
After checking, I notice that it no longer replaces the news part of the "facets_pretty_paths" module, but the effective first part of the URL remains untranslated.
"/search/type/news" should be "/search/type/news"
After removing the "break;" in the "getOutboundPath" function everything works as expected
wouter.h → created an issue.
wouter.h → created an issue.
Changes in the pull request.
wouter.h → created an issue.
This patch contains the existing patch + update the info.yml file for D10 compatibility.
wouter.h → created an issue.