Expand my Community achievements bar.

Learn about Edge Delivery Services in upcoming GEM session
SOLVED

create a childe tree when include another component

Avatar

Level 1

Hi, 

I'm new in AEM. 

I have a content "infoCard" that include another content "CTA". I would that in crxde, CTA properties in a child node. how can i do it?

 

following the code for the two components 

<?xml version="1.0" encoding="UTF-8"?>
<jcr:root
        xmlns:sling="http://sling.apache.org/jcr/sling/1.0"
        xmlns:cq="http://www.day.com/jcr/cq/1.0"
        xmlns:jcr="http://www.jcp.org/jcr/1.0"
        xmlns:nt="http://www.jcp.org/jcr/nt/1.0"
        xmlns:granite="http://www.adobe.com/jcr/granite/1.0"
        jcr:primaryType="nt:unstructured"
        jcr:title="Info Card"
        sling:resourceType="cq/gui/components/authoring/dialog">
    <content
            jcr:primaryType="nt:unstructured"
            sling:resourceType="granite/ui/components/coral/foundation/fixedcolumns">
        <items jcr:primaryType="nt:unstructured">
            <column
                    jcr:primaryType="nt:unstructured"
                    sling:resourceType="granite/ui/components/coral/foundation/container">
                <items jcr:primaryType="nt:unstructured">
                    <imgMobileAcordion jcr:primaryType="nt:unstructured"
                                       sling:resourceType="granite/ui/components/coral/foundation/accordion">
                        <items jcr:primaryType="nt:unstructured">
                            <panel jcr:primaryType="nt:unstructured" jcr:title="Mobile Image Configuration"
                                   sling:resourceType="granite/ui/components/coral/foundation/container">
                                <items jcr:primaryType="nt:unstructured">
                                    <image
                                            jcr:primaryType="nt:unstructured"
                                            sling:resourceType="cq/gui/components/authoring/dialog/fileupload"
                                            allowUpload="{Boolean}false"
                                            autoStart="{Boolean}false"
                                            class="cq-droptarget"
                                            disabled="{Boolean}false"
                                            fileNameParameter="./image/mobileFileName"
                                            fileReferenceParameter="./image/mobileFileReference"
                                            fieldLabel="image for mobile"
                                            fieldDescription="Drag and drop the image asset from DAM repository"
                                            mimeTypes="[image]"
                                            multiple="{Boolean}false"
                                            name="./image/imageMobile"
                                            useHTML5="{Boolean}true"/>
                                    <altText
                                            jcr:primaryType="nt:unstructured"
                                            sling:resourceType="granite/ui/components/coral/foundation/form/textfield"
                                            fieldDescription="Textual alternative of the meaning or function of the image, for visually impaired readers. If the alt is not set, the image is read by the 'screen readers' as a decorative element"
                                            fieldLabel="Image alt text"
                                            name="./image/alternativeTextMobile"/>
                                </items>
                            </panel>
                        </items>
                    </imgMobileAcordion>
                    <Cta
                            jcr:primaryType="nt:unstructured"
                            sling:resourceType="granite/ui/components/coral/foundation/include"
                            path="/mnt/overlay/gdi/components/content/cta/cq:dialog/content/items/baseSettings/items/accordionGroup/items/container-file/items/column/items/field"/>
                </items>
            </column>
        </items>
    </content>
</jcr:root>

 

<?xml version="1.0" encoding="UTF-8"?>
<jcr:root
        xmlns:sling="http://sling.apache.org/jcr/sling/1.0"
        xmlns:cq="http://www.day.com/jcr/cq/1.0"
        xmlns:jcr="http://www.jcp.org/jcr/1.0"
        xmlns:nt="http://www.jcp.org/jcr/nt/1.0"
        xmlns:granite="http://www.adobe.com/jcr/granite/1.0"
        jcr:primaryType="nt:unstructured"
        jcr:title="Properties"
        sling:resourceType="cq/gui/components/authoring/dialog">
    <content
            jcr:primaryType="nt:unstructured"
            sling:resourceType="granite/ui/components/coral/foundation/fixedcolumns">
        <items jcr:primaryType="nt:unstructured">
            <baseSettings
                    jcr:primaryType="nt:unstructured"
                    jcr:title="CTA Configuration"
                    sling:resourceType="granite/ui/components/foundation/section">
                <layout jcr:primaryType="nt:unstructured"
                        sling:resourceType="granite/ui/components/foundation/layouts/fixedcolumns"/>
                <items jcr:primaryType="nt:unstructured">

                    <accordionGroup jcr:primaryType="nt:unstructured"
                                    sling:resourceType="granite/ui/components/coral/foundation/accordion">
                        <items jcr:primaryType="nt:unstructured">
                            <container-file jcr:primaryType="nt:unstructured"
                                            sling:resourceType="granite/ui/components/foundation/container"
                                            jcr:title="Link Configuration">
                                <items jcr:primaryType="nt:unstructured">
                                    <column jcr:primaryType="nt:unstructured"
                                            granite:class="abc-ln-configurations-tab widget-xl"
                                            sling:resourceType="granite/ui/components/foundation/container">
                                        <items jcr:primaryType="nt:unstructured">
                                            <field
                                                    granite:class="cmp-teaser__editor-action"
                                                    jcr:primaryType="nt:unstructured"
                                                    sling:resourceType="granite/ui/components/coral/foundation/container"
                                                    name="./links">
                                                <items jcr:primaryType="nt:unstructured">
                                                    
                                                    <ctaAcordion jcr:primaryType="nt:unstructured"
                                                                  sling:resourceType="granite/ui/components/coral/foundation/accordion">
                                                        <items jcr:primaryType="nt:unstructured">
                                                            <panel jcr:primaryType="nt:unstructured" jcr:title="CTA Configuration"
                                                                   sling:resourceType="granite/ui/components/coral/foundation/container">
                                                                <items jcr:primaryType="nt:unstructured">
                                                                    <well jcr:primaryType="nt:unstructured"
                                                                          sling:resourceType="granite/ui/components/coral/foundation/well">
                                                                        <items jcr:primaryType="nt:unstructured">
                                                                            <ctaFormat
                                                                                    jcr:primaryType="nt:unstructured"
                                                                                    sling:resourceType="granite/ui/components/coral/foundation/form/select"
                                                                                    granite:class="toggle-visibility-source"
                                                                                    fieldDescription="The width attribute specifies the width of the component"
                                                                                    fieldLabel="Layout"
                                                                                    name="./link1/ctaLayout"
                                                                                    value="button_style">
                                                                                <items jcr:primaryType="nt:unstructured">
                                                                                    <text_on_the_left
                                                                                            jcr:primaryType="nt:unstructured"
                                                                                            text="button style"
                                                                                            value="button_style"/>
                                                                                    <text_on_the_right
                                                                                            jcr:primaryType="nt:unstructured"
                                                                                            text="arrow style"
                                                                                            value="arrow_style"/>
                                                                                </items>
                                                                                <granite:data
                                                                                        jcr:primaryType="nt:unstructured"
                                                                                        cq-msm-lockable="./link1/ctaLayout"/>
                                                                            </ctaFormat>
                                                                            <lnAcordion jcr:primaryType="nt:unstructured"
                                                                                        sling:resourceType="granite/ui/components/coral/foundation/accordion">
                                                                                <items jcr:primaryType="nt:unstructured">
                                                                                    <panel jcr:primaryType="nt:unstructured"
                                                                                           jcr:title="Link Configuration"
                                                                                           sling:resourceType="granite/ui/components/coral/foundation/container">
                                                                                        <items jcr:primaryType="nt:unstructured">
                                                                                            <href jcr:primaryType="nt:unstructured"
                                                                                                  fieldDescription="Link of the linked page"
                                                                                                  fieldLabel="Href"
                                                                                                  name="./link1/lnHref"
                                                                                                  rootPath="/content/gdi"
                                                                                                  sling:resourceType="cq/gui/components/coral/common/form/pagefield"
                                                                                                  required="{Boolean}true"
                                                                                                  wrapperClass="cmp-image__editor-link">
                                                                                                <granite:data jcr:primaryType="nt:unstructured"
                                                                                                              cq-msm-lockable="lnHref"/>
                                                                                            </href>
                                                                                            <anchor
                                                                                                    jcr:primaryType="nt:unstructured"
                                                                                                    fieldDescription="Anchor for the link"
                                                                                                    fieldLabel="Anchor"
                                                                                                    name="./link1/lnAnchor"
                                                                                                    sling:resourceType="granite/ui/components/coral/foundation/form/textfield">
                                                                                                <granite:data jcr:primaryType="nt:unstructured"
                                                                                                              cq-msm-lockable="./link1/lnAnchor"/>
                                                                                            </anchor>
                                                                                            <target
                                                                                                    jcr:primaryType="nt:unstructured"
                                                                                                    fieldLabel="Target Link"
                                                                                                    name="./link1/lnTarget"
                                                                                                    value="_self"
                                                                                                    sling:resourceType="granite/ui/components/coral/foundation/form/select">
                                                                                                <datasource
                                                                                                        jcr:primaryType="nt:unstructured"
                                                                                                        sling:resourceType="/apps/gdi/components/datasources/targetOptions"/>
                                                                                                <granite:data jcr:primaryType="nt:unstructured"
                                                                                                              cq-msm-lockable="./link1/lnTarget"/>
                                                                                            </target>
                                                                                            <label
                                                                                                    jcr:primaryType="nt:unstructured"
                                                                                                    fieldDescription="Defines the title of the link."
                                                                                                    fieldLabel="Label"
                                                                                                    name="./link1/lnLabel"
                                                                                                    sling:resourceType="granite/ui/components/coral/foundation/form/textfield">
                                                                                                <granite:data jcr:primaryType="nt:unstructured"
                                                                                                              cq-msm-lockable="./link1/lnLabel"/>
                                                                                            </label>
                                                                                            <accesskey
                                                                                                    jcr:primaryType="nt:unstructured"
                                                                                                    fieldDescription="Shortcut key to activate/focus the element"
                                                                                                    fieldLabel="Access Key"
                                                                                                    name="./link1/lnAccessKey"
                                                                                                    sling:resourceType="granite/ui/components/coral/foundation/form/textfield">
                                                                                                <granite:data jcr:primaryType="nt:unstructured"
                                                                                                              cq-msm-lockable="./link1/lnAccessKey"/>
                                                                                            </accesskey>
                                                                                            <tabindex
                                                                                                    jcr:primaryType="nt:unstructured"
                                                                                                    fieldDescription="The tab order of the element"
                                                                                                    fieldLabel="Tab Index"
                                                                                                    name="./link1/lnTabIndex"
                                                                                                    sling:resourceType="granite/ui/components/coral/foundation/form/numberfield"
                                                                                                    step="1">
                                                                                                <granite:data jcr:primaryType="nt:unstructured"
                                                                                                              cq-msm-lockable="./link1/lnTabIndex"/>
                                                                                            </tabindex>
                                                                                            <nofollowlink
                                                                                                    jcr:primaryType="nt:unstructured"
                                                                                                    sling:resourceType="granite/ui/components/coral/foundation/form/checkbox"
                                                                                                    allowBlank="true"
                                                                                                    fieldDescription="Relationship between the current document and the linked document"
                                                                                                    text="No follow link"
                                                                                                    name="./link1/lnNoFollow"
                                                                                                    value="true">
                                                                                                <granite:data jcr:primaryType="nt:unstructured"
                                                                                                              cq-msm-lockable="./link1/lnNoFollow"/>
                                                                                            </nofollowlink>
                                                                                            <resolveRedirects
                                                                                                    jcr:primaryType="nt:unstructured"
                                                                                                    sling:resourceType="granite/ui/components/coral/foundation/form/checkbox"
                                                                                                    fieldDescription="Use final page is a redirect page"
                                                                                                    text="Resolve page redirect"
                                                                                                    name="./link1/resolveRedirects"
                                                                                                    value="true">
                                                                                                <granite:data jcr:primaryType="nt:unstructured"
                                                                                                              cq-msm-lockable="./link1/resolveRedirects"/>
                                                                                            </resolveRedirects>
                                                                                        </items>
                                                                                    </panel>
                                                                                </items>
                                                                            </lnAcordion>
                                                                            <tealiumAcordion jcr:primaryType="nt:unstructured"
                                                                                             sling:resourceType="granite/ui/components/coral/foundation/accordion">
                                                                                <items jcr:primaryType="nt:unstructured">
                                                                                    <panel jcr:primaryType="nt:unstructured"
                                                                                           jcr:title="Tealium Configuration"
                                                                                           sling:resourceType="granite/ui/components/coral/foundation/container">
                                                                                        <items jcr:primaryType="nt:unstructured">
                                                                                            <idCta jcr:primaryType="nt:unstructured"
                                                                                                   fieldDescription="ID to be used by tealium."
                                                                                                   fieldLabel="CTA ID"
                                                                                                   name="./link1/tealiumIDCTA"
                                                                                                   sling:resourceType="granite/ui/components/coral/foundation/form/textfield">
                                                                                                <granite:data jcr:primaryType="nt:unstructured"
                                                                                                              cq-msm-lockable="./link1/tealiumIDCTA"/>
                                                                                            </idCta>
                                                                                            <wtSpaceId jcr:primaryType="nt:unstructured"
                                                                                                       fieldDescription="The context description used by Tealium for tracking the CTA."
                                                                                                       fieldLabel="Space ID"
                                                                                                       name="./link1/tealiumSpaceID"
                                                                                                       sling:resourceType="granite/ui/components/coral/foundation/form/textfield">
                                                                                                <granite:data jcr:primaryType="nt:unstructured"
                                                                                                              cq-msm-lockable="./link1/tealiumSpaceID"/>
                                                                                            </wtSpaceId>
                                                                                        </items>
                                                                                        <granite:data jcr:primaryType="nt:unstructured"
                                                                                                      column="2column"/>
                                                                                    </panel>
                                                                                </items>
                                                                                <parentConfig jcr:primaryType="nt:unstructured"
                                                                                              active="true"/>
                                                                            </tealiumAcordion>
                                                                        </items>
                                                                        <granite:data jcr:primaryType="nt:unstructured" element="link"/>
                                                                    </well>
                                                                </items>
                                                            </panel>
                                                        </items>
                                                    </ctaAcordion>
                                                </items>
                                            </field>
                                        </items>
                                    </column>
                                </items>
                            </container-file>
                        </items>
                    </accordionGroup>
                </items>
            </baseSettings>
        </items>
    </content>
</jcr:root>

 

 

Thanx a lot

 

 

1 Accepted Solution

Avatar

Correct answer by
Employee Advisor

Hi @atelzut ,
Below is the include syntax to include the other component dialog in your current component. I see that is already happening.

<Ctajcr:primaryType="nt:unstructured"sling:resourceType="granite/ui/components/coral/foundation/include"path="/mnt/overlay/gdi/components/content/cta/cq:dialog/content/items/baseSettings/items/accordionGroup/items/container-file/items/column/items/field"/>

Is you question related to how it will structure in content repository? If so, the content structure on the page is going to exactly how other node properties will be. The include dialog is used to utilize other component dialog in my component. so that if properties are same, you don't have to create it again. Let me know if you are trying to understand this.

Also, regarding reading the values in you sightly, you will use the sightly scripts which is ${properties.customproperty} of you can ready in the sling model using same code how you read other properties, using @inject annotation

View solution in original post

1 Reply

Avatar

Correct answer by
Employee Advisor

Hi @atelzut ,
Below is the include syntax to include the other component dialog in your current component. I see that is already happening.

<Ctajcr:primaryType="nt:unstructured"sling:resourceType="granite/ui/components/coral/foundation/include"path="/mnt/overlay/gdi/components/content/cta/cq:dialog/content/items/baseSettings/items/accordionGroup/items/container-file/items/column/items/field"/>

Is you question related to how it will structure in content repository? If so, the content structure on the page is going to exactly how other node properties will be. The include dialog is used to utilize other component dialog in my component. so that if properties are same, you don't have to create it again. Let me know if you are trying to understand this.

Also, regarding reading the values in you sightly, you will use the sightly scripts which is ${properties.customproperty} of you can ready in the sling model using same code how you read other properties, using @inject annotation