mirror of
https://github.com/getgrav/grav-plugin-admin.git
synced 2026-01-02 22:00:45 +01:00
Show more helpful error message if destination is not specified in a file field
This commit is contained in:
@@ -1652,6 +1652,15 @@ class AdminController
|
||||
|
||||
$upload = $this->normalizeFiles($_FILES['data'], $settings->name);
|
||||
|
||||
if (!isset($settings->destination)) {
|
||||
$this->admin->json_response = [
|
||||
'status' => 'error',
|
||||
'message' => $this->admin->translate('PLUGIN_ADMIN.DESTINATION_NOT_SPECIFIED', null, true)
|
||||
];
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// Do not use self@ outside of pages
|
||||
if ($this->view != 'pages' && in_array($settings->destination, ['@self', 'self@'])) {
|
||||
$this->admin->json_response = [
|
||||
|
||||
@@ -612,4 +612,5 @@ PLUGIN_ADMIN:
|
||||
DROPZONE_RESPONSE_ERROR: "Server responded with {{statusCode}} code."
|
||||
ADMIN_CACHING: "Enable Admin Caching"
|
||||
ADMIN_CACHING_HELP: "Caching in the admin can be controlled independently from the front-end site"
|
||||
DESTINATION_NOT_SPECIFIED: "Destination not specified"
|
||||
UPLOAD_ERR_NO_TMP_DIR: "Missing a temporary folder"
|
||||
|
||||
Reference in New Issue
Block a user