Display Virtuals As NoEdit Fields In Keystone Admin UI
Use the post init hook.
For example:
Assume the Post list model has the following, of which contentFull will be filled from the content.full virtual:
...
content: {
brief: { type: Types.Html, wysiwyg: true, height: 150 },
extended: { type: Types.Html, wysiwyg: true, height: 400 }
},
contentFull: {type: Types.Html, wysiwyg: true, height: 400, noedit: true}
...
Post.schema.virtual('content.full').get(function() {
return this.content.extended || this.content.brief;
});
Then you can fill up contentFull as follows:
Post.schema.post('init', function() {
this.contentFull = this.content.full;
});