public static function _handleFiles($theme, $data)
{
$oldRoot = '/home/extranet/www/fluidbook/themes/' . $theme->getAttribute('id') . '/';
- foreach ($data as $k => $v) {
-
- if (!$theme->hasField($k)) {
- continue;
- }
- $field = $theme->getField($k);
+ foreach ($theme->getFields() as $field) {
if (!($field instanceof Files)) {
continue;
}
+ $k = $field->getName();
+ $v = $data[$k] ?? null;
+
if (!$v) {
$theme->deleteMediaInField($k);
continue;
continue;
}
}
+
$media = $theme->getMediaInField($k);
$upload = false;