Monday 27 June 2016

Hybris - Add a CMS Component Step-by-Step


1. create a item first like below 


<itemtype code="MyComponent" generate="true"

    jaloclass="de.hybris.platform.yacceleratorcore.jalo.cms2.components.MyComponent"

    extends="CMSParagraphComponent" autocreate="true">

<itemtype code="MyComponent" generate="true"

    jaloclass="de.hybris.platform.yacceleratorcore.jalo.cms2.components.MyComponent"

    extends="CMSParagraphComponent" autocreate="true">

    <attributes>

        <attribute qualifier="media" generate="true" autocreate="true" type="localized:Media">

           <persistence type="property" />

        </attribute>

    </attributes>

</itemtype>


2. Update -locales_en.properties file by Adding localized attribute names and descriptions

type.MyComponent.name=My Paragraph Component



3. Creating Controller

    create a new  controller class by extending AbstractCMSComponentController
       a. @Override fillModel method
       b. add @RequestMapping


4. Create View MyComponent.jsp


5. Add component to Valid Component Types

    add the component entry to cms-content.impex
$narrowContent=ProductFeatureComponent


Alternately you can add entries to ComponentTypeGroups2ComponentType


6.  You can customize the hybris WCMS Cockpit for the component via the XML configuration:

editorArea_typeName.xml: configuration file for the WCMS Cockpit editor area.
contentEditor_typeName.xml: configuration file for Live Edit mode and in-line editing.
wizardConfig_typeName.xml: wizard configuration, if a component is added via a wizard dialogue.

No comments:

Post a Comment