11

From my knowledge, there is a set of fields that can be rendered out using a FieldRenderer like text, numbers, dates, etc. Additonally, there are also fields that cannot be rendered out, such as fields that stores ID's or list of ID's, like links, references, etc.

Instead of hard-coding my knowledge, I would like to know if there is a way where I can check if a field (type) has FieldRenderer support, or not (in code). Is this possible?

3 Answers 3

8

You could create a function that checks the fieldtypes.. based on the renderField pipeline, which is executed in the fieldRenderer you should include these types:

  • rich text
  • single-line text
  • text
  • image
  • link
  • general link
  • internal link
  • multi-line text
  • memo
  • date
  • datetime
  • word document
  • integer
  • number

That should be the complete list (on a Sitecore 8.1).

There are some surprises in there, like "word document". But also note that DropList is not in there! (also mentioned here that droplist is supported by <sc:text> but not by the FieldRenderer.

8

Every field can be passed through FieldRenderer. The <sc:FieldRenderer> control makes use of the FieldRenderer.Render static method, which can be used on any field.

FieldRenderer.Render passes the field through the field rendering pipeline.

Whether or not the text in a given field is actually transformed by the field rendering pipeline is an entirely different matter.

By default there are a limited set of field rendering pipeline handlers, but these are completely configurable, so it will depend entirely on whether or not the project you're working on has had its field rendering pipeline customized.

1
  • 1
    While this answer is not as comprehensive as the marked answer, I agree with the statement that every field can go through the FieldRenderer.Render method. Just what comes out the other side is definitely a different story.
    – Pete Navarra
    Oct 28, 2016 at 4:02
3

As far I know all the fields from bellow images can be rendered with FieldRenderer control. All the fields that can be renderes using sc:Link, sc:Image, sc:Date or sc:Text

enter image description here

enter image description here

1
  • 1
    Not all fields that can be rendered with sc:Text are supported by the FieldRenderer apparently. So this list is not accurate..
    – Gatogordo
    Oct 18, 2016 at 14:33

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.