What is the use of Parbase component:

a 夏天 提交于 2019-12-19 02:06:41

问题


I couldn't understand the need for a parbase component in CQ5. From what I read in CQ5 documentation, parbase is a component that can extend from other components. But all the components can extend other components by specifying sling:resourceSuperType property. So what is the need for a parbase component?


回答1:


As per the Day documentation, "The parbase allows components to inherit attributes from other components"

If you check under "/libs/foundation/components", most of the authorable and draggable components have 'parbase' set as their 'sling:resourceSuperType' so that they can inherit the image and text rendering properties when added to a Paragraph system (Parsys Component).

This is a standard followed by all the Out-Of-the-Box components in CQ5.

While creating your own components, you don't need to add 'parbase' as a supertype, unless your components need to be enabled with drag-drop in a parsys.

AFAIK, the parbase component is never used explicitly, but only facilitates the rendering of a component when added in the Parsys.




回答2:


Parbase is just a component from which you extend to get some OOTB functionality.

If I can say in technical language, Parbase is a key component as it allows components to inherit attributes from other components, similar to subclasses in object oriented languages such as Java.

For example, when you open the /libs/foundation/components/text node in the CRX Explorer, you see that it has a property named sling:resourceSuperType, which references the parbase component. The parbase here defines tree scripts to render images, titles, and so on, so that all components subclassed from this parbase can use this script.



来源:https://stackoverflow.com/questions/21400388/what-is-the-use-of-parbase-component

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!