mirror of
https://github.com/processwire/processwire.git
synced 2025-08-10 08:44:46 +02:00
Update per processwire/processwire-issues#648
This commit is contained in:
@@ -361,7 +361,6 @@ class PagesEditor extends Wire {
|
||||
* @param array $options
|
||||
* - format: Optionally specify the format to use, or leave blank to auto-determine.
|
||||
* @return string If a name was generated it is returned. If no name was generated blank is returned.
|
||||
* @throws WireException if unique name can't be generated (highly unlikely)
|
||||
*
|
||||
*/
|
||||
public function setupPageName(Page $page, array $options = array()) {
|
||||
@@ -608,6 +607,9 @@ class PagesEditor extends Wire {
|
||||
$page->set($nameField, $pageName);
|
||||
$query->bindValue(":$nameField", $this->wire('sanitizer')->pageName($pageName, Sanitizer::toAscii));
|
||||
|
||||
// indicate that page has a modified name
|
||||
$this->pages->names()->hasAdjustedName($page, true);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@@ -109,6 +109,19 @@ class PagesNames extends Wire {
|
||||
return $name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Does the given page have a modified “name” during this request?
|
||||
*
|
||||
* @param Page $page
|
||||
* @param bool|null $set Specify boolean true or false to set whether or not it has an adjusted name, or omit just to get
|
||||
* @return bool
|
||||
*
|
||||
*/
|
||||
public function hasAdjustedName(Page $page, $set = null) {
|
||||
if(is_bool($set)) $page->setQuietly('_hasAdjustedName', $set);
|
||||
return $page->get('_hasAdjustedName') ? true : false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Is given page name an untitled page name?
|
||||
*
|
||||
|
@@ -1197,9 +1197,9 @@ class ProcessPageAdd extends Process implements ConfigurableModule, WirePageEdit
|
||||
return false;
|
||||
}
|
||||
|
||||
$this->createdPageMessage($this->page);
|
||||
|
||||
if($pageName != $this->page->name) {
|
||||
$this->createdPageMessage($this->page);
|
||||
|
||||
if($this->wire('pages')->names()->hasAdjustedName($this->page)) {
|
||||
$warning = $this->nameChangedWarning($this->page, $pageName);
|
||||
if($warning) $this->warning($warning);
|
||||
}
|
||||
|
Reference in New Issue
Block a user