Update to 3.5.7.1

This commit is contained in:
Lukas Bestle
2021-07-07 11:53:53 +02:00
parent 62b533a28f
commit 9bc881f37e
11 changed files with 607 additions and 616 deletions

View File

@@ -2,6 +2,9 @@
namespace Kirby\Cms;
use Kirby\Data\Data;
use Throwable;
/**
* A collection of layouts
* @since 3.5.0
@@ -37,4 +40,27 @@ class Layouts extends Items
return parent::factory($items, $params);
}
/**
* Parse layouts data
*
* @param array|string $input
* @return array
*/
public static function parse($input): array
{
if (empty($input) === false && is_array($input) === false) {
try {
$input = Data::decode($input, 'json');
} catch (Throwable $e) {
return [];
}
}
if (empty($input) === true) {
return [];
}
return $input;
}
}

View File

@@ -321,8 +321,8 @@ class Collection extends Iterator implements Countable
/**
* Alias for `Kirby\Toolkit\Collection::filter`
*
* @param string|Closure $field
* @param array ...$args
* @param string|array|\Closure $field
* @param mixed ...$args
* @return static
*/
public function filterBy(...$args)