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

1

2

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));
    }
Lara answered 10/12, 2012 at 19:54 Comment(0)
G
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>

Gilletta answered 10/12, 2012 at 21:24 Comment(2)
Thanks a lot, it woks. the interesting that happened is I tried this way with different Alternate template so instead of "Fields.Common.Text-Benefits" I created "Fields.Common.Text-Category-Benefits" and it didn't work. so we have to use specific template to be able to do it?Lara
Yes, you have to specify the name of the field. You can cater it to the type with something like this <Match ContentType="Category"><Place Fields.Common.Text-Benefits="Content:1"/></Match>Olives

© 2022 - 2024 — McMap. All rights reserved.