Have two field with the same type in one page with arbitrary place.

时间秒杀一切 提交于 2019-12-08 01:38:41

问题


I created the CategoryPart and I added two text field to it. I want to add some custom data in the page between two text fields data. The problem is when I want to specify the place of the text field in Placement.info I just have one Shap "Fields_Common_Text" for all the text fields in the page so I can't specify different places for different fields with the same type. Is there any way to do it in Orchard? Thanks in advance.

my Placement.info is like this:

   <Placement>
      <Match DisplayType ="Detail">
         <Place Parts_Category="Content:9"></Place>
        <Place Fields_Common_Text="Content:10"></Place> 
      </Match>
   </Placement>

The display method in driver:

   protected override DriverResult Display(CategoryPart part, string displayType, dynamic shapeHelper)
    {          
        return ContentShape("Parts_Category", () => shapeHelper.Parts_Category(CategoryPart: part));
    }

回答1:


Yes there is. You can specify placement for the items with the shape type and the name of the field. For example, if your text fields are named CategoryName and CategoryType, you can define following placement:

<Placement>
  <Match DisplayType ="Detail">
     <Place Fields_Common_Text-CategoryName="Content:9"></Place>
     <Place Fields_Common_Text-CategoryType="Content:10"></Place> 
  </Match>



来源:https://stackoverflow.com/questions/13808167/have-two-field-with-the-same-type-in-one-page-with-arbitrary-place

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!