Upgrade to 3.4.3

This commit is contained in:
Bastian Allgeier
2020-09-15 10:25:09 +02:00
parent 54b9ba3047
commit d8e797dd9b
108 changed files with 1750 additions and 523 deletions

View File

@@ -27,7 +27,7 @@ class Api extends BaseApi
* Execute an API call for the given path,
* request method and optional request data
*
* @param string $path
* @param string|null $path
* @param string $method
* @param array $requestData
* @return mixed
@@ -50,8 +50,9 @@ class Api extends BaseApi
/**
* @param mixed $model
* @param string $name
* @param string $path
* @param string|null $path
* @return mixed
* @throws \Kirby\Exception\NotFoundException if the field type cannot be found or the field cannot be loaded
*/
public function fieldApi($model, string $name, string $path = null)
{
@@ -73,8 +74,9 @@ class Api extends BaseApi
}
}
// it can get this error only if $name is an empty string as $name = ''
if ($field === null) {
throw new NotFoundException('The field "' . $fieldNames . '" could not be found');
throw new NotFoundException('No field could be loaded');
}
$fieldApi = $this->clone([
@@ -89,9 +91,10 @@ class Api extends BaseApi
* Returns the file object for the given
* parent path and filename
*
* @param string $path Path to file's parent model
* @param string|null $path Path to file's parent model
* @param string $filename Filename
* @return \Kirby\Cms\File|null
* @throws \Kirby\Exception\NotFoundException if the file cannot be found
*/
public function file(string $path = null, string $filename)
{
@@ -115,6 +118,8 @@ class Api extends BaseApi
*
* @param string $path Path to parent model
* @return \Kirby\Cms\Model|null
* @throws \Kirby\Exception\InvalidArgumentException if the model type is invalid
* @throws \Kirby\Exception\NotFoundException if the model cannot be found
*/
public function parent(string $path)
{
@@ -151,7 +156,7 @@ class Api extends BaseApi
$model = $kirby->user(basename($path));
break;
default:
throw new InvalidArgumentException('Invalid file model type: ' . $modelType);
throw new InvalidArgumentException('Invalid model type: ' . $modelType);
}
if ($model) {
@@ -188,6 +193,7 @@ class Api extends BaseApi
*
* @param string $id Page's id
* @return \Kirby\Cms\Page|null
* @throws \Kirby\Exception\NotFoundException if the page cannot be found
*/
public function page(string $id)
{
@@ -206,6 +212,12 @@ class Api extends BaseApi
]);
}
/**
* Returns the current Session instance
*
* @param array $options Additional options, see the session component
* @return \Kirby\Session\Session
*/
public function session(array $options = [])
{
return $this->kirby->session(array_merge([
@@ -214,7 +226,10 @@ class Api extends BaseApi
}
/**
* Setter for the parent Kirby instance
*
* @param \Kirby\Cms\App $kirby
* @return self
*/
protected function setKirby(App $kirby)
{
@@ -237,8 +252,9 @@ class Api extends BaseApi
* returns the current authenticated user if no
* id is passed
*
* @param string $id User's id
* @param string|null $id User's id
* @return \Kirby\Cms\User|null
* @throws \Kirby\Exception\NotFoundException if the user for the given id cannot be found
*/
public function user(string $id = null)
{