mirror of
https://github.com/processwire/processwire.git
synced 2025-08-17 20:11:46 +02:00
Fix issue processwire/processwire-issues#1462
This commit is contained in:
@@ -364,6 +364,7 @@ abstract class Process extends WireData implements Module {
|
||||
$config = $this->wire()->config;
|
||||
$modules = $this->wire()->modules;
|
||||
$sanitizer = $this->wire()->sanitizer;
|
||||
$languages = $this->wire()->languages;
|
||||
|
||||
$info = $modules->getModuleInfoVerbose($this);
|
||||
$name = $sanitizer->pageName($name);
|
||||
@@ -384,12 +385,14 @@ abstract class Process extends WireData implements Module {
|
||||
if(!$parent || !$parent->id) $parent = $adminPage; // default
|
||||
$page = $parent->child("include=all, name=$name"); // does it already exist?
|
||||
if($page->id && "$page->process" == "$this") return $page; // return existing copy
|
||||
if($languages) $languages->setDefault();
|
||||
$page = $pages->newPage($template ? $template : 'admin');
|
||||
$page->name = $name;
|
||||
$page->parent = $parent;
|
||||
$page->process = $this;
|
||||
$page->title = $title ? $title : $info['title'];
|
||||
foreach($extras as $key => $value) $page->set($key, $value);
|
||||
if($languages) $languages->unsetDefault();
|
||||
$pages->save($page, array('adjustName' => true));
|
||||
if(!$page->id) throw new WireException("Unable to create page: $parent->path$name");
|
||||
$this->message(sprintf($this->_('Created Page: %s'), $page->path));
|
||||
|
Reference in New Issue
Block a user