0

I am creating a template in Sitecore 9 with following fields.

  • Title - single line text field

  • Description - multi line field

Now, I want to add 2 image fields but their type is not Image, they are defined in a CustomImage template, for example

LeftImage - based on CustomImage template

RightImage - based on CustomImage template

CustomImage template fields are

  • ImageTitle - single line text field

  • ImageSource - general link filed

  • ImagePosition - dropdown with left and right options

One way to achieve this is to create a composite field control and use that but I am trying to avoid that, is there any other way?

1
  • If you want to add it as a field type, only option is the create custom field. Other option is to separately create those CustomImage template items in a location and in the main template just provide two droplink fields with source query parameters to limit template items that can be selected for those fields. Sep 11, 2018 at 6:37

1 Answer 1

1

Are multiple ways to implement something similar.

  1. One simple way to do it is to create LeftImage and RightImage field like a DropLink and the datasource will point to an item which have you have CustomImage items.

  2. Other option which is better from my point of view is to have LeftImage and RightImage renderings which have datasource a CustomImage template.

    In this way you can use personalization and AB testing for the components. You need to set for your RightImage renderings DataSourceTemplate and DataSourceLocation.

    In this way the editor will be forced to have the right items for your renderings.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.