Skip to content

Commit

Permalink
chore(field): Ensure color value is a string on update_value (#35)
Browse files Browse the repository at this point in the history
Co-authored-by: Brandon <brandon@tendency.me>
  • Loading branch information
zcuric and Log1x committed Oct 14, 2022
1 parent 091182d commit 468c8a8
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/Field.php
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,13 @@ public function validate_value($valid, $value, $field, $input)
*/
public function update_value($value, $post_id, $field)
{
return ! empty($value) ? $this->palette($value) : $value;
if (empty($value)) {
return $value;
}

$value = is_string($value) ? $value : $value['slug'];

return $this->palette($value);
}

/**
Expand Down

0 comments on commit 468c8a8

Please sign in to comment.