Upgrade to rc5

This commit is contained in:
Bastian Allgeier
2020-12-10 11:24:42 +01:00
parent 3fec0d7c93
commit c378376bc9
257 changed files with 13009 additions and 1846 deletions

View File

@@ -79,8 +79,9 @@ class App
* Creates a new App instance
*
* @param array $props
* @param bool $setInstance If false, the instance won't be set globally
*/
public function __construct(array $props = [])
public function __construct(array $props = [], bool $setInstance = true)
{
// register all roots to be able to load stuff afterwards
$this->bakeRoots($props['roots'] ?? []);
@@ -110,7 +111,9 @@ class App
]);
// set the singleton
Model::$kirby = static::$instance = $this;
if (static::$instance === null || $setInstance === true) {
Model::$kirby = static::$instance = $this;
}
// setup the I18n class with the translation loader
$this->i18n();
@@ -333,6 +336,24 @@ class App
return $router->call($path ?? $this->path(), $method ?? $this->request()->method());
}
/**
* Creates an instance with the same
* initial properties
*
* @param array $props
* @param bool $setInstance If false, the instance won't be set globally
* @return self
*/
public function clone(array $props = [], bool $setInstance = true)
{
$props = array_replace_recursive($this->propertyData, $props);
$clone = new static($props, $setInstance);
$clone->data = $this->data;
return $clone;
}
/**
* Returns a specific user-defined collection
* by name. All relevant dependencies are