1
0
mirror of https://github.com/processwire/processwire.git synced 2025-08-12 01:34:31 +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:
Ryan Cramer
2017-03-07 08:49:28 -05:00
parent bc032e1ce3
commit d7d392fe95

View File

@@ -489,6 +489,7 @@ class PageTraversal {
public function urlOptions(Page $page, $options = array()) {
$config = $page->wire('config');
$template = $page->template;
$defaults = array(
'http' => is_bool($options) ? $options : false,
@@ -499,10 +500,13 @@ class PageTraversal {
'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;
$template = $page->template;
$sanitizer = $page->wire('sanitizer');
$language = null;
$url = null;