1

What is the core usage of a Component Definition item?

Is it used to store the rendering parameters of the component? Or does it allow the component to be added to a placeholder? Or Both?

1 Answer 1

3

Component/Rendering/Sublayout (depending how you call it or which technology you are using WebForms or MVC) definition item is an item in Sitecore content tree which defines a rendering.

It is used for storing following information:

  • Name
  • Description
  • Experience Editor buttons
  • Global Caching options (if set here will be applied to all instance of rendering).
  • what is the Controller name and Action name that should be used to render rendering (in case you are using MVC)
  • What is the path to the view file (if you are using WebForms or xslt)
  • Parameters Template - what is the template of rendering paramters. If you open renderings options in Experience Editor you will see those options
  • Default datasource location
  • Datasource template

As you can see it describe the rendering in general. We can say it describe the type of a rendering (similar analogy to object oriented programming concept of type and instance of types)

It is used to store the rendering parameters of the component

No. Like I said above it is just a rendering (type) definition. If you add rendering to a page then it will create an instance of this rendering but rendering parameters won't be stored in component definition item but in __Renderings or __Final Renderings fields of your current page item)

This is how rendering instance is stored in one of those fields:

<r uid="{B343725A-3A93-446E-A9C8-3A2CBD3DB489}" s:par="Param1=Value1" />

Notice the s:par attribute.

or it allows the components to be added to a placeholder?

To define whether rendering can be added to a particular placeholder is set in different place. Search for Placeholder Settings to learn more.

This video might give you some overview:

Friday Sitecore Best Practice: How to Properly Use Placeholder Settings https://www.youtube.com/watch?v=HDNdVLFTNLc

Your Answer

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

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