Skip to content

Commit 4a23548

Browse files
committed
fix: UUID handling
1 parent f5872b5 commit 4a23548

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

config/fields/mixins/picker.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,16 +130,21 @@
130130
return $ids;
131131
},
132132
'toId' => function (ModelWithContent $model) {
133-
return $model->id();
133+
return $model->uuid()?->toString() ?? $model->id();
134134
},
135135
'toItem' => function (ModelWithContent $model) {
136-
return $model->panel()->pickerData([
136+
$item = $model->panel()->pickerData([
137137
'image' => $this->image,
138138
'info' => $this->info ?? false,
139139
'layout' => $this->layout,
140140
'model' => $this->model(),
141141
'text' => $this->text,
142142
]);
143+
144+
return [
145+
...$item,
146+
'id' => $item['uuid'] ?? $item['id']
147+
];
143148
},
144149
'toItems' => function (array $models = []) {
145150
return A::map(

src/Panel/Controller/Dialog/ModelsPickerDialogController.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,13 +60,18 @@ abstract public function find(string $id): ModelWithContent|null;
6060
*/
6161
public function item(ModelWithContent $model): array
6262
{
63-
return $model->panel()->pickerData([
63+
$item = $model->panel()->pickerData([
6464
'model' => $this->model,
6565
'image' => $this->image,
6666
'info' => $this->info,
6767
'layout' => $this->layout,
6868
'text' => $this->text,
6969
]);
70+
71+
return [
72+
...$item,
73+
'id' => $item['uuid'] ?? $item['id']
74+
];
7075
}
7176

7277
/**

0 commit comments

Comments
 (0)