Upgrade to 3.2.0

This commit is contained in:
Bastian Allgeier
2019-06-25 09:56:08 +02:00
parent 9e18cf635d
commit 9c89153d35
296 changed files with 14408 additions and 2504 deletions

View File

@@ -4,27 +4,36 @@ namespace Kirby\Cms;
use Kirby\Toolkit\Str;
/**
* HasChildren
*
* @package Kirby Cms
* @author Bastian Allgeier <bastian@getkirby.com>
* @link https://getkirby.com
* @copyright Bastian Allgeier GmbH
* @license https://getkirby.com/license
*/
trait HasChildren
{
/**
* The Pages collection
*
* @var Pages
* @var Kirby\Cms\Pages
*/
public $children;
/**
* The list of available drafts
*
* @var Pages
* @var Kirby\Cms\Pages
*/
public $drafts;
/**
* Returns the Pages collection
*
* @return Pages
* @return Kirby\Cms\Pages
*/
public function children()
{
@@ -38,7 +47,7 @@ trait HasChildren
/**
* Returns all children and drafts at the same time
*
* @return Pages
* @return Kirby\Cms\Pages
*/
public function childrenAndDrafts()
{
@@ -60,7 +69,7 @@ trait HasChildren
* Searches for a child draft by id
*
* @param string $path
* @return Page|null
* @return Kirby\Cms\Page|null
*/
public function draft(string $path)
{
@@ -93,7 +102,7 @@ trait HasChildren
/**
* Return all drafts of the model
*
* @return Pages
* @return Kirby\Cms\Pages
*/
public function drafts()
{
@@ -118,7 +127,7 @@ trait HasChildren
* Finds one or multiple children by id
*
* @param string ...$arguments
* @return Pages
* @return Kirby\Cms\Page|Kirby\Cms\Pages
*/
public function find(...$arguments)
{
@@ -128,7 +137,7 @@ trait HasChildren
/**
* Finds a single page or draft
*
* @return Page|null
* @return Kirby\Cms\Page|null
*/
public function findPageOrDraft(string $path)
{
@@ -138,9 +147,9 @@ trait HasChildren
/**
* Returns a collection of all children of children
*
* @return Pages
* @return Kirby\Cms\Pages
*/
public function grandChildren(): Pages
public function grandChildren()
{
return $this->children()->children();
}
@@ -171,7 +180,7 @@ trait HasChildren
*/
public function hasInvisibleChildren(): bool
{
return $this->children()->invisible()->count() > 0;
return $this->hasUnlistedChildren();
}
/**
@@ -200,16 +209,16 @@ trait HasChildren
*/
public function hasVisibleChildren(): bool
{
return $this->children()->listed()->count() > 0;
return $this->hasListedChildren();
}
/**
* Creates a flat child index
*
* @param bool $drafts
* @return Pages
* @return Kirby\Cms\Pages
*/
public function index(bool $drafts = false): Pages
public function index(bool $drafts = false)
{
if ($drafts === true) {
return $this->childrenAndDrafts()->index($drafts);