Umbraco 7:从另一种文档类型复制属性

时间:2014-08-28 11:43:41

标签: asp.net asp.net-mvc umbraco umbraco7

我的Document Types部分结构如下:

Master
  Home
  Common

问:如何将属性从Common复制到Home,以便我可以在首页Content中对其进行编辑并让它进行编辑该属性的自有版本?

1 个答案:

答案 0 :(得分:3)

您无法以这种方式复制属性。您必须手动在“主页”文档类型下重新创建属性。最好的办法是将属性添加到主服务器(假设您没有此类型的页面),然后其他两个文档类型将继承该属性。这是因为您没有其他文档类型作为主文档类型的直接子项。

所以我们可以这样看:

'+'=文件类型 ' - '=财产

+Master
  -Title
  -Description
  +Home
    -Title(inherited from Master)
    -Description(inherited from Master)
    -Gallery (unique to Home document type)
  +Common
    -Title(inherited from Master)
    -Description(inherited from Master)
    -Photos (unique to Common document type)
    -Gallery (unique to Common document type)

在上面的示例中,“Home”和“Common”文档类型都需要gallery属性。但是,它不一定对主模板的其他子项有效。因此,我们不得不复制该属性,因为我们无法将其添加到master中,或者其他模板也会继承该属性。因此,为了解决这个问题(如下面的评论所述),你应该做这样的事情:

'+' = Document Type
'-' = Property

+Master
  -Title (defined in Master)
  -Description (defined in Master)

  +Other
    -Title(inherited from Master)
    -Description(inherited from Master)

  +Test
    -Gallery(defined in Test)

    +Home
      -Title(inherited from Master)
      -Description(inherited from Master)
      -Gallery (inherited from Test)

    +Common
      -Title(inherited from Master)
      -Description(inherited from Master)
      -Photos (unique to Common document type)
      -Gallery (inherited from Test)