mirror of
https://github.com/getgrav/grav-plugin-admin.git
synced 2026-03-29 17:00:05 +02:00
@@ -769,8 +769,13 @@ class AdminBaseController
|
||||
} elseif ($obj instanceof UserInterface and $key === 'avatar') {
|
||||
$obj->set($key, $files);
|
||||
} else {
|
||||
// TODO: [this is JS handled] if it's single file, remove existing and use set, if it's multiple, use join
|
||||
$obj->join($key, $files); // stores
|
||||
// For single file fields, replace existing value to prevent stale file entries
|
||||
$fieldSettings = $obj->blueprints()->schema()->getProperty($key);
|
||||
if (is_array($fieldSettings) && empty($fieldSettings['multiple'])) {
|
||||
$obj->set($key, $files);
|
||||
} else {
|
||||
$obj->join($key, $files);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user