mirror of
https://github.com/processwire/processwire.git
synced 2025-08-13 10:15:28 +02:00
Fix issue #187 where $page->httpUrl didn't respect Template::slashUrls==0 setting when used in non-multi-language.
This commit is contained in:
@@ -489,6 +489,7 @@ class PageTraversal {
|
|||||||
public function urlOptions(Page $page, $options = array()) {
|
public function urlOptions(Page $page, $options = array()) {
|
||||||
|
|
||||||
$config = $page->wire('config');
|
$config = $page->wire('config');
|
||||||
|
$template = $page->template;
|
||||||
|
|
||||||
$defaults = array(
|
$defaults = array(
|
||||||
'http' => is_bool($options) ? $options : false,
|
'http' => is_bool($options) ? $options : false,
|
||||||
@@ -499,10 +500,13 @@ class PageTraversal {
|
|||||||
'language' => is_object($options) && $options instanceof Page && $options->className() === 'Language' ? $options : null,
|
'language' => is_object($options) && $options instanceof Page && $options->className() === 'Language' ? $options : null,
|
||||||
);
|
);
|
||||||
|
|
||||||
if(empty($options)) return rtrim($config->urls->root, '/') . $page->path();
|
if(empty($options)) {
|
||||||
|
$url = rtrim($config->urls->root, '/') . $page->path();
|
||||||
|
if($template->slashUrls === 0 && $page->id > 1) $url = rtrim($url, '/');
|
||||||
|
return $url;
|
||||||
|
}
|
||||||
|
|
||||||
$options = is_array($options) ? array_merge($defaults, $options) : $defaults;
|
$options = is_array($options) ? array_merge($defaults, $options) : $defaults;
|
||||||
$template = $page->template;
|
|
||||||
$sanitizer = $page->wire('sanitizer');
|
$sanitizer = $page->wire('sanitizer');
|
||||||
$language = null;
|
$language = null;
|
||||||
$url = null;
|
$url = null;
|
||||||
|
Reference in New Issue
Block a user