Upgrade to 4.0.0

This commit is contained in:
Bastian Allgeier
2023-11-28 09:33:56 +01:00
parent f96b96af76
commit 3b0b6546ca
480 changed files with 21371 additions and 13327 deletions

View File

@@ -2,6 +2,8 @@
namespace Kirby\Cms;
use Kirby\Content\Content;
/**
* Represents a single Layout with
* multiple columns
@@ -19,24 +21,13 @@ class Layout extends Item
public const ITEMS_CLASS = Layouts::class;
/**
* @var \Kirby\Cms\Content
*/
protected $attrs;
/**
* @var \Kirby\Cms\LayoutColumns
*/
protected $columns;
protected Content $attrs;
protected LayoutColumns $columns;
/**
* Proxy for attrs
*
* @param string $method
* @param array $args
* @return \Kirby\Cms\Field
*/
public function __call(string $method, array $args = [])
public function __call(string $method, array $args = []): mixed
{
// layout methods
if ($this->hasMethod($method) === true) {
@@ -48,8 +39,6 @@ class Layout extends Item
/**
* Creates a new Layout object
*
* @param array $params
*/
public function __construct(array $params = [])
{
@@ -66,20 +55,16 @@ class Layout extends Item
/**
* Returns the attrs object
*
* @return \Kirby\Cms\Content
*/
public function attrs()
public function attrs(): Content
{
return $this->attrs;
}
/**
* Returns the columns in this layout
*
* @return \Kirby\Cms\LayoutColumns
*/
public function columns()
public function columns(): LayoutColumns
{
return $this->columns;
}
@@ -87,24 +72,18 @@ class Layout extends Item
/**
* Checks if the layout is empty
* @since 3.5.2
*
* @return bool
*/
public function isEmpty(): bool
{
return $this
->columns()
->filter(function ($column) {
return $column->isNotEmpty();
})
->filter('isEmpty', false)
->count() === 0;
}
/**
* Checks if the layout is not empty
* @since 3.5.2
*
* @return bool
*/
public function isNotEmpty(): bool
{
@@ -114,8 +93,6 @@ class Layout extends Item
/**
* The result is being sent to the editor
* via the API in the panel
*
* @return array
*/
public function toArray(): array
{