mirror of
https://github.com/processwire/processwire.git
synced 2025-08-09 00:06:55 +02:00
Fix issue where adding a new page was broken by commit b47297fd4a
This commit is contained in:
@@ -1891,12 +1891,10 @@ class Pages extends Wire {
|
|||||||
|
|
||||||
if(empty($options)) return $this->wire(new Page());
|
if(empty($options)) return $this->wire(new Page());
|
||||||
|
|
||||||
$id = isset($options['id']) && $options['id'] > 0 ? (int) $options['id'] : null;
|
|
||||||
$options = $this->editor()->newPageOptions($options);
|
$options = $this->editor()->newPageOptions($options);
|
||||||
$template = isset($options['template']) ? $options['template'] : null;
|
$template = isset($options['template']) ? $options['template'] : null;
|
||||||
$parent = isset($options['parent']) ? $options['parent'] : null;
|
$parent = isset($options['parent']) ? $options['parent'] : null;
|
||||||
$class = empty($options['pageClass']) ? 'Page' : $options['pageClass'];
|
$class = empty($options['pageClass']) ? 'Page' : $options['pageClass'];
|
||||||
if($id !== null) $options['id'] = $id;
|
|
||||||
|
|
||||||
unset($options['template'], $options['parent'], $options['pageClass']);
|
unset($options['template'], $options['parent'], $options['pageClass']);
|
||||||
|
|
||||||
|
@@ -1873,7 +1873,11 @@ class PagesEditor extends Wire {
|
|||||||
if($template) $options['template'] = $template;
|
if($template) $options['template'] = $template;
|
||||||
if($class) $options['pageClass'] = $class;
|
if($class) $options['pageClass'] = $class;
|
||||||
|
|
||||||
unset($options['id']); // just in case it was there
|
if(isset($options['id']) && ctype_digit("$options[id]") && (int) $options['id'] > 0) {
|
||||||
|
$options['id'] = (int) $options['id'];
|
||||||
|
} else {
|
||||||
|
unset($options['id']);
|
||||||
|
}
|
||||||
|
|
||||||
return $options;
|
return $options;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user