diff options
Diffstat (limited to 'acf/model/node.lua')
-rw-r--r-- | acf/model/node.lua | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/acf/model/node.lua b/acf/model/node.lua index 380f809..eb06b2d 100644 --- a/acf/model/node.lua +++ b/acf/model/node.lua @@ -56,6 +56,9 @@ function TreeNode:init(context) util.update(mt, context) mt.meta = {} + + if not mt.txn then return end + if mt.parent then mt.meta['ui-name'] = getmetatable(mt.parent).mmeta( pth.name(mt.path) @@ -118,6 +121,10 @@ function Collection:init(context, params) local field = BoundMember(self, params.field) local mt = getmetatable(self) + function mt.topology() return field:topology(pth.wildcard) end + function mt.valid_member(name) return true end + + if not mt.txn then return end mt.meta.type = 'collection' mt.meta.members = field:meta(pth.wildcard) @@ -125,8 +132,6 @@ function Collection:init(context, params) mt.meta['ui-name'], 's$', '' ) - function mt.valid_member(name) return true end - function mt.mmeta(name) local res = util.copy(mt.meta.members) res['ui-name'] = mt.meta['ui-member']..' '..name @@ -210,6 +215,7 @@ meta = meta_func('meta') mmeta = meta_func('mmeta') parent = meta_func('parent') path = meta_func('path') +topology = meta_func('topology') validate = meta_func('validate') |