1
0
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:
Ryan Cramer
2025-06-13 13:57:36 -04:00
parent 99cdf49bad
commit 9f9cc65680

View File

@@ -1947,6 +1947,11 @@ class Pages extends Wire {
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);
$page = $this->wire(new $class($template));