Upgrade to 3.2.0
This commit is contained in:
@@ -10,13 +10,18 @@ use Kirby\Form\Field;
|
||||
use Kirby\Toolkit\A;
|
||||
use Kirby\Toolkit\F;
|
||||
use Kirby\Toolkit\I18n;
|
||||
use Kirby\Toolkit\Obj;
|
||||
use Throwable;
|
||||
|
||||
/**
|
||||
* The Blueprint class normalizes an array from a
|
||||
* blueprint file and converts sections, columns, fields
|
||||
* etc. into a correct tab layout.
|
||||
*
|
||||
* @package Kirby Cms
|
||||
* @author Bastian Allgeier <bastian@getkirby.com>
|
||||
* @link https://getkirby.com
|
||||
* @copyright Bastian Allgeier GmbH
|
||||
* @license https://getkirby.com/license
|
||||
*/
|
||||
class Blueprint
|
||||
{
|
||||
@@ -81,13 +86,13 @@ class Blueprint
|
||||
}
|
||||
|
||||
/**
|
||||
* Improved var_dump output
|
||||
* Improved `var_dump` output
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function __debuginfo(): array
|
||||
{
|
||||
return $this->props;
|
||||
return $this->props ?? [];
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -217,7 +222,7 @@ class Blueprint
|
||||
*
|
||||
* @param string $name
|
||||
* @param string $fallback
|
||||
* @param Model $model
|
||||
* @param Kirby\Cms\Model $model
|
||||
* @return self
|
||||
*/
|
||||
public static function factory(string $name, string $fallback = null, Model $model)
|
||||
@@ -311,11 +316,9 @@ class Blueprint
|
||||
* Loads a blueprint from file or array
|
||||
*
|
||||
* @param string $name
|
||||
* @param string $fallback
|
||||
* @param Model $model
|
||||
* @return array
|
||||
*/
|
||||
public static function load(string $name)
|
||||
public static function load(string $name): array
|
||||
{
|
||||
if (isset(static::$loaded[$name]) === true) {
|
||||
return static::$loaded[$name];
|
||||
@@ -349,7 +352,7 @@ class Blueprint
|
||||
/**
|
||||
* Returns the parent model
|
||||
*
|
||||
* @return Model
|
||||
* @return Kirby\Cms\Model
|
||||
*/
|
||||
public function model()
|
||||
{
|
||||
@@ -402,7 +405,7 @@ class Blueprint
|
||||
return $columns;
|
||||
}
|
||||
|
||||
public static function helpList(array $items)
|
||||
public static function helpList(array $items): string
|
||||
{
|
||||
$md = [];
|
||||
|
||||
@@ -503,6 +506,12 @@ class Blueprint
|
||||
$fieldProps = [];
|
||||
}
|
||||
|
||||
// unset / remove field if its propperty is false
|
||||
if ($fieldProps === false) {
|
||||
unset($fields[$fieldName]);
|
||||
continue;
|
||||
}
|
||||
|
||||
// inject the name
|
||||
$fieldProps['name'] = $fieldName;
|
||||
|
||||
@@ -580,6 +589,12 @@ class Blueprint
|
||||
{
|
||||
foreach ($sections as $sectionName => $sectionProps) {
|
||||
|
||||
// unset / remove section if its propperty is false
|
||||
if ($sectionProps === false) {
|
||||
unset($sections[$sectionName]);
|
||||
continue;
|
||||
}
|
||||
|
||||
// inject all section extensions
|
||||
$sectionProps = $this->extend($sectionProps);
|
||||
|
||||
@@ -648,6 +663,12 @@ class Blueprint
|
||||
|
||||
foreach ($tabs as $tabName => $tabProps) {
|
||||
|
||||
// unset / remove tab if its propperty is false
|
||||
if ($tabProps === false) {
|
||||
unset($tabs[$tabName]);
|
||||
continue;
|
||||
}
|
||||
|
||||
// inject all tab extensions
|
||||
$tabProps = $this->extend($tabProps);
|
||||
|
||||
@@ -691,9 +712,9 @@ class Blueprint
|
||||
* Returns a single section by name
|
||||
*
|
||||
* @param string $name
|
||||
* @return Section|null
|
||||
* @return Kirby\Cms\Section|null
|
||||
*/
|
||||
public function section(string $name): ?Section
|
||||
public function section(string $name)
|
||||
{
|
||||
if (empty($this->sections[$name]) === true) {
|
||||
return null;
|
||||
|
Reference in New Issue
Block a user