UI Configuration

The UI configuration is responsible for configuration of the user interface of each widget instance.

Different files are related to the UI configuration.

File

Description

cockpit-config.xml

This configuration is the merged UI configuration of the entire Backoffice application.

You modify this file using the Application Orchestrator. From the Application Orchestrator editing view, click the SAP Commerce Cloud logo at the top right, and then click Show cockpit-config.xml. For more information, see Application Orchestrator - End User Guide.

This file is stored as a Media item.

myextension/resources/myextension-backoffice-config.xml

Configuration of cockpit components at the extension level.

myextension/backoffice/resources/widgets/mywidget/cockpit-config.xml

An optional configuration file for your widget. Can be considered as a default configuration.

cockpit-config.xml Import

It is possible to import the content of one cockpit-config.xml file to another cockpit-config.xml file. It is achieved by using an import element, like shown below:

<import resource="extension-backoffice-config/config-to-import.xml"/>

The import element can be created with more parameters which are used in the imported files. Parameters, which are required to create a correct cockpit-config.xml file, are listed in the required-parameters attribute in the <config> element. This way of managing the cockpit-config.xml files helps to avoid the repetitions in the configuration. Below, you can find examples of importing one cockpit-config.xml file into another.

cockpit-config.xml

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<config xmlns="http://www.hybris.com/cockpit/config"
		xmlns:et="http://www.hybris.com/cockpitng/config/explorertree"
		required-parameters="typeCode,position">

	<context component="explorer-tree">
		<et:explorer-tree>
			<et:type-node id="explorer-tree-nodes-$typeCode" code="$typeCode" position="$position"/>
		</et:explorer-tree>
	</context>

</config>

Above, you can see how the typeCode and position attributes are added as a required attributes. Those attributes also define how they are used in the creation of a tree node id and of type code it represents, and define node position in the Explorer Tree.

cockpit-config.xml

<?xml version="1.0" encoding="UTF-8"?>
<config xmlns="http://www.hybris.com/cockpit/config">

    <import resource="extension-backoffice-config/config-to-import.xml" typeCode="Product" position="10"/>

    <import resource="extension-backoffice-config/config-to-import.xml" typeCode="Category" position="20"/>

    <import resource="extension-backoffice-config/config-to-import.xml" typeCode="PriceRow" position="30"/>

</config>

The imports are created with the typeCode and position attributes which allows to create multiple Explorer Tree nodes with a desired order.

Extra parameters of the <import> element can be passed further in the imported file. Below, you can find an example of how to achieve that:

cockpit-config.xml

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<config xmlns="http://www.hybris.com/cockpit/config"
        xmlns:wz="http://www.hybris.com/cockpitng/config/wizard-config"
		required-parameters="typeCode">

    <!--

        #set( $wizardId = $typeCode + "Wizard" )

    -->

    <import resource="create-wizard-hide-attribute.xml" typeCode="$typeCode" qualifier="conditionallyVisibleAttribute" trigger="otherAttibute" condition="otherAttibute != null"/>

	<context type="$typeCode" component="create-wizard" merge-by="type">
        <wz:flow id="$wizardId" title="create.title(ctx.TYPE_CODE)">
            <wz:step id="step1">
                <wz:content id="step1.content">
                    <wz:property-list root="new$typeCode">
                        <wz:property qualifier="otherAttibute"/>
                        <wz:property qualifier="conditionallyVisibleAttribute"/>
                    </wz:property-list>
                </wz:content>
            </wz:step>
        </wz:flow>
    </context>

</config>

The typeCode parameter is passed further to the create-wizard-hide-attribute.xml file. Then, the typeCode attribute, which was passed before, is used in the imported create-wizard-hide-attribute.xml file.

create-wizard-hide-attribute.xml

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<config xmlns="http://www.hybris.com/cockpit/config"
        xmlns:df="http://www.hybris.com/cockpitng/component/dynamicForms"
		required-parameters="typeCode,qualifier,trigger,condition">
	<requires resource="config-to-import.xml"/>

	<context type="$typeCode" component="configurableFlowDynamicForms">
        <df:dynamicForms modelProperty="new$typeCode">
            <df:attribute id="showHide$typeCode$qualifier" triggeredOn="$condition" qualifier="$qualifier" visibleIf="$condition"/>
        </df:dynamicForms>
    </context>

</config>

In the code snippet above, a requires element is used. It allows to define dependencies between different cockpit-config.xml files. A file is not imported unless the specified cockpit-config.xml file was imported before.