Rashad
Rashad

Reputation: 103

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

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));
    }

Upvotes: 2

Views: 456

Answers (1)

Ivan Ferić
Ivan Ferić

Reputation: 4763

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>

Upvotes: 1

Related Questions