Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.
SOLVED

What is the use of Parbase component?

Avatar

Level 2

I couldn't understand the need for a parbase component in CQ5. From what I read on http://dev.day.com/docs/en/cq/current/wcm/default_components/designmode.html, parbase is a component that can extend from other components. But all components can extend other components by specifying sling:resourceSuperType property. So what is the need for a parbase component?

Thanks in Advance. 

1 Accepted Solution

Avatar

Correct answer by
Level 8

The primary purpose of the parbase is to provide a location for common selector based scripts that are shared by multiple components. If you look at the scripts contained in /libs/foundation/components/parbase you will see the image script (which happens to be a servlet) and the scaffolding scripts. Both of these provide common functionality that doesn't change from component to component. By having a parbase component and having most of your components inherit from it (either directly or indirectly) you would have to duplicate the image script in multiple locations. Generally all components end up inheriting from parbase, even if they have one or more components in between. 

View solution in original post

3 Replies

Avatar

Correct answer by
Level 8

The primary purpose of the parbase is to provide a location for common selector based scripts that are shared by multiple components. If you look at the scripts contained in /libs/foundation/components/parbase you will see the image script (which happens to be a servlet) and the scaffolding scripts. Both of these provide common functionality that doesn't change from component to component. By having a parbase component and having most of your components inherit from it (either directly or indirectly) you would have to duplicate the image script in multiple locations. Generally all components end up inheriting from parbase, even if they have one or more components in between. 

Avatar

Level 2

orotas wrote...

The primary purpose of the parbase is to provide a location for common selector based scripts that are shared by multiple components. If you look at the scripts contained in /libs/foundation/components/parbase you will see the image script (which happens to be a servlet) and the scaffolding scripts. Both of these provide common functionality that doesn't change from component to component. By having a parbase component and having most of your components inherit from it (either directly or indirectly) you would have to duplicate the image script in multiple locations. Generally all components end up inheriting from parbase, even if they have one or more components in between. 

 

Thanks orotas for your reply. I still cant understand how it is different from sling:resourceSuperType?

Avatar

Level 8

It isn't any different than the sling:resourceSuperType - if you want utilize the parbase you declare it as your component's sling:resourceSuperType. There is nothing special about the parbase - it's just component that happens to serve a special purpose in you component hierarchy. I'd say 90% of component's declare parbase to be their sling:resourceSuperType.