mirror of
https://github.com/processwire/processwire.git
synced 2025-08-08 15:57:01 +02:00
Refactor the Templates::getParentPage() method. This should hopefully fix processwire/processwire-issues#1929 ... also removed the Template::noShortcut check from that method since it didn't really belong there, and moved it to ProcessPageList and ProcessPageLister. Some phpdoc updates as well.
This commit is contained in:
@@ -185,6 +185,7 @@ class ProcessPageAdd extends Process implements ConfigurableModule, WirePageEdit
|
||||
if(!$user->isGuest() && $user->hasPermission('page-edit')) {
|
||||
|
||||
foreach($templates as $template) {
|
||||
if($template->noShortcut) continue;
|
||||
$parent = $template->getParentPage(true);
|
||||
if(!$parent) continue;
|
||||
if($parent->id) {
|
||||
|
@@ -2221,6 +2221,9 @@ class ProcessPageLister extends Process implements ConfigurableModule {
|
||||
if($this->parent && $this->parent->id && $this->parent->addable()) {
|
||||
$action = "?parent_id={$this->parent->id}";
|
||||
|
||||
} else if($this->template && $this->template->noShortcut) {
|
||||
// not allowed in add-new list
|
||||
|
||||
} else if($this->template && ($parent = $this->template->getParentPage(true))) {
|
||||
if($parent->id) {
|
||||
$action = "?parent_id=$parent->id"; // defined parent
|
||||
|
Reference in New Issue
Block a user