Not everything is for everyone. This simple law of nature binds everything together. A polar beer is best kept away tropical area. Your business may want to keep only coordinated banners in rotating image banners. The content slots are bounded to have only few type of components to achieve these restrictions.
Components are grouped on basis of their types. These groups are termed as ComponentTypeGroup. There is one to many relations between this group and the components. They are persisted in database. In earlier versions, the valid component list was used just as macro in impex.
This approach is more optimal than the previous one which had a slow many to many relationship between ContentSlotName and Cms Component type.
<relation code="ComponentTypeGroups2ComponentType" generate="true" localized="false" autocreate="true"> <deployment table="CompTypeGrp2CompType" typecode="1097" /> <sourceElement qualifier="componentTypeGroups" type="ComponentTypeGroup" cardinality="many" collectiontype="set"/> <targetElement qualifier="cmsComponentTypes" type="CMSComponentType" cardinality="many" collectiontype="set"/> </relation>
There are few groups which are defined in OOB Hybris. We can also define our custom groups.
INSERT_UPDATE ComponentTypeGroup;code[unique=true] ;logo ;headerlinks ;searchbox ;minicart ;wide ;narrow ;footer ;navigation ;mobile
Each valid component type is added to the group.
INSERT_UPDATE ComponentTypeGroups2ComponentType;source(code)[unique=true];target(code)[unique=true] ;narrow;ProductFeatureComponent ;narrow;CategoryFeatureComponent
When a component type is checked against its validity for a given content slot, the system checks if it is contained in the component type group.
INSERT_UPDATE ContentSlotName;name[unique=true];template(uid,$contentCV)[unique=true][default='LandingPage4Template'];validComponentTypes(code);compTypeGroup(code) ;SiteLogo;;;logo ;HeaderLinks;;;headerlinks ;SearchBox;;;searchbox ;MiniCart;;;minicart ;NavigationBar;;;navigation ;Section1;;;wide ;Section2A;;;narrow ;Section2B;;;narrow ;Section2C;;;wide ;Section3;;;wide ;Section4;;;narrow ;Section5;;;wide ;Footer;;;footer ;TopHeaderSlot;;;wide ;BottomHeaderSlot;;;wide ;PlaceholderContentSlot;;;