This commit is contained in:
Bastian Allgeier
2020-07-07 12:40:13 +02:00
parent 5f025ac2c2
commit f79d2e960c
176 changed files with 10532 additions and 5343 deletions

View File

@@ -3,6 +3,7 @@
namespace Kirby\Toolkit;
use ArgumentCountError;
use Kirby\Exception\Exception;
use Kirby\Exception\InvalidArgumentException;
use TypeError;
@@ -224,8 +225,12 @@ class Component
$definition = static::$types[$type];
// load definitions from string
if (is_array($definition) === false) {
static::$types[$type] = $definition = include $definition;
if (is_string($definition) === true) {
if (is_file($definition) !== true) {
throw new Exception('Component definition ' . $definition . ' does not exist');
}
static::$types[$type] = $definition = F::load($definition);
}
return $definition;