mirror of
https://github.com/processwire/processwire.git
synced 2025-08-10 16:54:44 +02:00
Update $pages->newPage() method so that it can also accept template name or ID for the template option
This commit is contained in:
@@ -1946,6 +1946,11 @@ class Pages extends Wire {
|
||||
$class = empty($options['pageClass']) ? 'Page' : $options['pageClass'];
|
||||
|
||||
unset($options['template'], $options['parent'], $options['pageClass']);
|
||||
|
||||
if($template && !$template instanceof Template) {
|
||||
$template = $this->wire()->templates->get($template);
|
||||
if(!$template instanceof Template) $template = null;
|
||||
}
|
||||
|
||||
if(strpos($class, "\\") === false) $class = wireClassName($class, true);
|
||||
|
||||
|
Reference in New Issue
Block a user