summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--acf2/model/field.lua9
1 files changed, 7 insertions, 2 deletions
diff --git a/acf2/model/field.lua b/acf2/model/field.lua
index 76c8931..001a77b 100644
--- a/acf2/model/field.lua
+++ b/acf2/model/field.lua
@@ -328,8 +328,6 @@ function M.TreeNode:load(context, options)
end
function M.TreeNode:save(context, value)
- self:check_editable(context)
-
local path = context.path
if value == path then return end
@@ -338,6 +336,13 @@ function M.TreeNode:save(context, value)
return
end
+ local check = value ~= nil and next(value) ~= nil
+ if not check then
+ local old = self:_load(context)
+ if old and next(old) ~= nil then check = true end
+ end
+ if check then self:check_editable(context) end
+
self:_save(context)
if value then