玉兰自定义内容类型作为属性

时间:2019-02-08 14:27:07

标签: java content-management-system yaml magnolia

我定义了两种内容类型:

author-ct.yaml

datasource:
  workspace: books
  rootPath: /
  namespaces:
    lib: https://www.magnolia-travel.com/jcr/1.0/lib
  autoCreate: true

model:
  nodeType: lib:author
  properties:
    - name: name
    - birthdate: Date

books-ct.yaml

datasource:
  workspace: books
  rootPath: /
  namespaces:
    lib: https://www.magnolia-travel.com/jcr/1.0/lib
  autoCreate: true

model:
  nodeType: lib:book
  properties:
    - name: author
      type: lib:author
    - name: ed
      type: Boolean
    - name: title
    - name: description
    - name: publisher
    - name: publish_date
      type: Date
    - name: isbn13

如您所见,我定义了类型为lib:author的author属性(在author-ct.yaml中定义)

当我创建类型为lib:book的新项目时,将出现以下编辑器: enter image description here

我可以在作者字段中键入任何内容,并保存对象而不会出现错误。看起来木兰忽略了我提供的类型,并为属性'author'使用了String类型。我希望在那里有一些定义好的作者。我该如何实现?

1 个答案:

答案 0 :(得分:1)

文档指出“ You can only reference submodels defined in the same content type”。您是否尝试过在//@version=3 study("My Script", precision=0) plot(volume) 内定义lib:author