Skip to content

Commit 7a30258

Browse files
authored
fix(field): Fix default value return format (Fixes #26) (#40)
* enhance(css): Add margin between the label and editor palette input
1 parent a8e744e commit 7a30258

File tree

5 files changed

+8
-4
lines changed

5 files changed

+8
-4
lines changed

assets/css/field.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
}
99

1010
.acf-input {
11-
@apply max-w-xs;
11+
@apply max-w-xs mt-2;
1212

1313
ul {
1414
@apply list-none grid grid-cols-6 gap-y-3 m-0 p-0;

plugin.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* Plugin Name: Advanced Custom Fields: Editor Palette Field
55
* Plugin URI: https://github.com/log1x/acf-editor-palette
66
* Description: A Gutenberg-like editor palette color picker field for Advanced Custom Fields.
7-
* Version: 1.1.0
7+
* Version: 1.1.1
88
* Author: Brandon Nifong
99
* Author URI: https://github.com/log1x
1010
*/

public/css/field.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

public/mix-manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
{
22
"/js/field.js": "/js/field.js?id=ffc7c64cd20bf0834b74",
3-
"/css/field.css": "/css/field.css?id=80d77494b6548b463aa0"
3+
"/css/field.css": "/css/field.css?id=5d81ea651b71d5759ed7"
44
}

src/Field.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,10 @@ public function format_value($value, $post_id, $field)
236236
{
237237
$format = $field['return_format'] ?? $this->defaults['return_format'];
238238

239+
if (is_string($value)) {
240+
$value = $this->palette($value);
241+
}
242+
239243
return $format === 'array' ? $value : ($value[$format] ?? $value);
240244
}
241245

0 commit comments

Comments
 (0)