summaryrefslogtreecommitdiffstats
path: root/acf2/model/field.lua
diff options
context:
space:
mode:
Diffstat (limited to 'acf2/model/field.lua')
-rw-r--r--acf2/model/field.lua8
1 files changed, 4 insertions, 4 deletions
diff --git a/acf2/model/field.lua b/acf2/model/field.lua
index fe7fc07..c31e6be 100644
--- a/acf2/model/field.lua
+++ b/acf2/model/field.lua
@@ -61,9 +61,7 @@ function M.Field:init(params)
if self.choice then
self.choice = map(
function(choice)
- if type(choice) ~= 'table' then
- choice = {choice, self:auto_ui_name(choice)}
- end
+ if type(choice) ~= 'table' then choice = {choice} end
for i, k in ipairs{'value', 'ui-value'} do
if choice[i] then
assert(not choice[k])
@@ -71,7 +69,9 @@ function M.Field:init(params)
choice[i] = nil
end
end
- return choice
+ return util.setdefaults(
+ choice, {['ui-value']=self:auto_ui_name(choice.value)}
+ )
end,
self.choice
)