Skip to content

Commit 68cb7c6

Browse files
committed
fix: accidental added code block
1 parent ae81c3e commit 68cb7c6

File tree

1 file changed

+2
-45
lines changed

1 file changed

+2
-45
lines changed

packages/uploadcare-field/src/Uploadcare.php

Lines changed: 2 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -190,53 +190,14 @@ public static function make(string $name, Field $field): Input
190190
} else {
191191
// Process each item in the state array
192192
$extractedFiles = [];
193-
193+
194194
foreach ($state as $item) {
195195
if (is_array($item)) {
196196
$extractedFiles[] = self::mapMediaToValue($item);
197+
197198
continue;
198199
}
199200

200-
\Log::info("[CROP DEBUG] Hydrating media {$mediaUlid} in field {$fieldName}", [
201-
'has_pivot' => $m->relationLoaded('pivot') && $m->pivot !== null,
202-
'has_pivot_meta' => $m->relationLoaded('pivot') && $m->pivot && $m->pivot->meta !== null,
203-
]);
204-
205-
if ($m->relationLoaded('pivot') && $m->pivot && $m->pivot->meta) {
206-
$meta = is_string($m->pivot->meta) ? json_decode($m->pivot->meta, true) : $m->pivot->meta;
207-
if (is_array($meta)) {
208-
$m->setAttribute('hydrated_edit', $meta);
209-
}
210-
}
211-
$contextModel = clone $record;
212-
if ($m->relationLoaded('pivot') && $m->pivot) {
213-
$contextModel->setRelation('pivot', $m->pivot);
214-
} else {
215-
$dummyPivot = new \Backstage\Models\ContentFieldValue;
216-
$dummyPivot->setAttribute('meta', null);
217-
$contextModel->setRelation('pivot', $dummyPivot);
218-
}
219-
$m->setRelation('edits', new \Illuminate\Database\Eloquent\Collection([$contextModel]));
220-
});
221-
}
222-
223-
if ($foundModels->count() === 1 && count($state) > 1) {
224-
$newState = [self::mapMediaToValue($foundModels->first())];
225-
} else {
226-
$newState = $foundModels->map(fn ($m) => self::mapMediaToValue($m))->all();
227-
}
228-
229-
} else {
230-
// Process each item in the state array
231-
$extractedFiles = [];
232-
233-
foreach ($state as $item) {
234-
if (is_array($item)) {
235-
$extractedFiles[] = self::mapMediaToValue($item);
236-
237-
continue;
238-
}
239-
240201
if (! is_string($item)) {
241202
continue;
242203
}
@@ -471,8 +432,6 @@ public static function mutateFormDataCallback(Model $record, Field $field, array
471432
return $data;
472433
}
473434

474-
475-
476435
$values = null;
477436

478437
// 1. Try to get from property first (set by EditContent)
@@ -540,8 +499,6 @@ public static function mutateBeforeSaveCallback(Model $record, Field $field, arr
540499
$valueColumn = $record->valueColumn ?? 'values';
541500

542501
$values = self::findFieldValues($data, $field);
543-
544-
545502

546503
if ($values === '' || $values === [] || $values === null || empty($values)) {
547504
// Check if key exists using strict check to avoid wiping out data that wasn't submitted

0 commit comments

Comments
 (0)