1
0
mirror of https://github.com/processwire/processwire.git synced 2025-08-26 08:04:38 +02:00
This commit is contained in:
Ryan Cramer
2019-02-04 10:51:31 -05:00
parent debb1cd511
commit 0be324b4d5
2 changed files with 16 additions and 5 deletions

View File

@@ -18,6 +18,8 @@
* @method array getAllowedTemplates($parent = null) * @method array getAllowedTemplates($parent = null)
* @method string nameChangedWarning(Page $page, $namePrevious) * @method string nameChangedWarning(Page $page, $namePrevious)
* *
* @property bool|int $noAutoPublish Disable automatic publishing?
*
*/ */
class ProcessPageAdd extends Process implements ConfigurableModule, WirePageEditor { class ProcessPageAdd extends Process implements ConfigurableModule, WirePageEditor {
@@ -280,7 +282,7 @@ class ProcessPageAdd extends Process implements ConfigurableModule, WirePageEdit
*/ */
public function ___executeTemplate() { public function ___executeTemplate() {
$templateID = (int) $this->input->get->template_id; $templateID = (int) $this->input->get('template_id');
if(!$templateID) throw new WireException("No template specified"); if(!$templateID) throw new WireException("No template specified");
$template = $this->templates->get($templateID); $template = $this->templates->get($templateID);
if(!$template) throw new WireException("Unknown template"); if(!$template) throw new WireException("Unknown template");
@@ -343,6 +345,7 @@ class ProcessPageAdd extends Process implements ConfigurableModule, WirePageEdit
* *
*/ */
public function renderChooseTemplate() { public function renderChooseTemplate() {
/** @var array $data */
$data = $this->executeNavJSON(array('getArray' => true)); $data = $this->executeNavJSON(array('getArray' => true));
$out = ''; $out = '';
$bookmarkItem = null; $bookmarkItem = null;
@@ -742,7 +745,7 @@ class ProcessPageAdd extends Process implements ConfigurableModule, WirePageEdit
$form->attr('id', 'ProcessPageAdd'); $form->attr('id', 'ProcessPageAdd');
$form->addClass('InputfieldFormFocusFirst'); $form->addClass('InputfieldFormFocusFirst');
$form->attr('action', './' . ($this->input->get->modal ? "?modal=1" : '')); $form->attr('action', './' . ($this->input->get('modal') ? "?modal=1" : ''));
$form->attr('data-ajax-url', $this->wire('config')->urls->admin . 'page/add/'); $form->attr('data-ajax-url', $this->wire('config')->urls->admin . 'page/add/');
$form->attr('data-dup-note', $this->_('The name entered is already in use. If you do not modify it, the name will be made unique automatically after you save.')); $form->attr('data-dup-note', $this->_('The name entered is already in use. If you do not modify it, the name will be made unique automatically after you save.'));
$form->attr('method', 'post'); $form->attr('method', 'post');
@@ -998,7 +1001,13 @@ class ProcessPageAdd extends Process implements ConfigurableModule, WirePageEdit
$this->deleteOldTempPages(); $this->deleteOldTempPages();
// allow for nameFormat to come from a name_format GET variable // allow for nameFormat to come from a name_format GET variable
$nameFormat = $this->sanitizer->text($this->input->get('name_format')); $nameFormat = $this->wire('input')->get('name_format');
if(strlen($nameFormat)) {
$nameFormat = $this->sanitizer->chars($this->sanitizer->text($nameFormat), '-_[alpha][digit]', '-');
} else {
if(count($parent->template->childTemplates) > 1) return false;
$nameFormat = '';
}
$nameFormatTemplate = $parent->template->childNameFormat; $nameFormatTemplate = $parent->template->childNameFormat;
if(strlen($nameFormat)) { if(strlen($nameFormat)) {
// temporarily assign to the template->childNameFormat property // temporarily assign to the template->childNameFormat property
@@ -1178,7 +1187,7 @@ class ProcessPageAdd extends Process implements ConfigurableModule, WirePageEdit
if($publishNow && $publishAdd) { if($publishNow && $publishAdd) {
$this->session->redirect("./?parent_id={$this->page->parent_id}&template_id={$this->page->template->id}"); $this->session->redirect("./?parent_id={$this->page->parent_id}&template_id={$this->page->template->id}");
} else { } else {
$this->session->redirect("../edit/?id={$this->page->id}&new=1" . ($this->input->get->modal ? "&modal=1" : '')); $this->session->redirect("../edit/?id={$this->page->id}&new=1" . ($this->input->get('modal') ? "&modal=1" : ''));
} }
return true; return true;
@@ -1294,6 +1303,8 @@ class ProcessPageAdd extends Process implements ConfigurableModule, WirePageEdit
public function getShortcutSortField() { public function getShortcutSortField() {
$this->wire('session')->remove($this, 'nav'); $this->wire('session')->remove($this, 'nav');
/** @var array $data */
$data = $this->executeNavJSON(array('getArray' => true)); $data = $this->executeNavJSON(array('getArray' => true));
$name = 'shortcutSort'; $name = 'shortcutSort';

View File

@@ -948,7 +948,7 @@ class ProcessTemplate extends Process {
* Edit the fields that are part of this template * Edit the fields that are part of this template
* *
* @param Template $template * @param Template $template
* @return InputfieldAsmSelect * @return InputfieldAsmSelect|InputfieldMarkup
* *
*/ */
protected function buildEditFormFields(Template $template) { protected function buildEditFormFields(Template $template) {