Skip to content

Commit 468c8a8

Browse files
zcuricLog1x
andauthored
chore(field): Ensure color value is a string on update_value (#35)
Co-authored-by: Brandon <brandon@tendency.me>
1 parent 091182d commit 468c8a8

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/Field.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,13 @@ public function validate_value($valid, $value, $field, $input)
272272
*/
273273
public function update_value($value, $post_id, $field)
274274
{
275-
return ! empty($value) ? $this->palette($value) : $value;
275+
if (empty($value)) {
276+
return $value;
277+
}
278+
279+
$value = is_string($value) ? $value : $value['slug'];
280+
281+
return $this->palette($value);
276282
}
277283

278284
/**

0 commit comments

Comments
 (0)