Upgrade to rc5

This commit is contained in:
Bastian Allgeier
2020-12-10 11:24:42 +01:00
parent 3fec0d7c93
commit c378376bc9
257 changed files with 13009 additions and 1846 deletions

View File

@@ -23,9 +23,11 @@ use Kirby\Toolkit\Str;
trait PageActions
{
/**
* Changes the sorting number
* Changes the sorting number.
* The sorting number must already be correct
* when the method is called
* when the method is called.
* This only affects this page,
* siblings will not be resorted.
*
* @param int|null $num
* @return self
@@ -168,7 +170,9 @@ trait PageActions
/**
* Change the status of the current page
* to either draft, listed or unlisted
* to either draft, listed or unlisted.
* If changing to `listed`, you can pass a position for the
* page in the siblings collection. Siblings will be resorted.
*
* @param string $status "draft", "listed" or "unlisted"
* @param int|null $position Optional sorting number
@@ -203,7 +207,7 @@ trait PageActions
}
/**
* @param int $position
* @param int|null $position
* @return self
*/
protected function changeStatusToListed(int $position = null)
@@ -247,6 +251,19 @@ trait PageActions
return $page;
}
/**
* Change the position of the page in its siblings
* collection. Siblings will be resorted. If the page
* status isn't yet `listed`, it will be changed to it.
*
* @param int|null $position
* @return self
*/
public function changeSort(int $position = null)
{
return $this->changeStatus('listed', $position);
}
/**
* Changes the page template
*
@@ -545,7 +562,7 @@ trait PageActions
return $num;
default:
// get instance with default language
$app = $this->kirby()->clone();
$app = $this->kirby()->clone([], false);
$app->setCurrentLanguage();
$template = Str::template($mode, [
@@ -735,7 +752,7 @@ trait PageActions
}
$parent = $this->parentModel();
$parent->children = $parent->children()->sortBy('num', 'asc');
$parent->children = $parent->children()->sort('num', 'asc');
return true;
}
@@ -761,18 +778,22 @@ trait PageActions
$sibling->changeNum($index);
}
$parent->children = $siblings->sortBy('num', 'asc');
$parent->children = $siblings->sort('num', 'asc');
}
return true;
}
/**
* @deprecated 3.5.0 Use `Page::changeSort()` instead
*
* @param null $position
* @return self
*/
public function sort($position = null)
{
deprecated('$page->sort() is deprecated, use $page->changeSort() instead. $page->sort() will be removed in Kirby 3.6.0.');
return $this->changeStatus('listed', $position);
}