Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.
SOLVED

Inheritance in metadata schema for assets?

Avatar

Level 4

I was hoping to be able to add 2 fields in a new tab which applied to PDF's. I was looking at creating a meta data schema with the folder structure application/pdf and I'd add my 2 fields there. But when I apply it - I only get my 2 fields. I lose all other options. 

 

I really don't want to (needless) copy everything to my new schema. I'd prefer to inherit from the existing defaults and overlay my new tab with its properties.

 

I even tried creating a tab1 with properties of sling:resourceSupertype = /libs/dam/content/schemaeditors/forms/default/application/pdf/items/tabs/items/tab1 as crazy possibility (spoiler: it just NPE's on ...Tab.merge when you try that)

 

Here's an example of the crx structure I had in mind and was experimenting with

metadataschema-screenshot.PNG

 

 

Does the functionality I'm hoping for exist? 

1 Accepted Solution

Avatar

Correct answer by
Employee Advisor

Hi @tim_funk ,
As per your requirement, you just need to create a new tab and then add custom fields, In this case you don't need to create a new metadata schema. You can simply edit the default one and add your tab and custom field. Something like below screenshot:

Screen Shot 2022-04-04 at 4.26.26 PM.pngScreen Shot 2022-04-04 at 4.28.42 PM.png

View solution in original post

3 Replies

Avatar

Correct answer by
Employee Advisor

Hi @tim_funk ,
As per your requirement, you just need to create a new tab and then add custom fields, In this case you don't need to create a new metadata schema. You can simply edit the default one and add your tab and custom field. Something like below screenshot:

Screen Shot 2022-04-04 at 4.26.26 PM.pngScreen Shot 2022-04-04 at 4.28.42 PM.png

Avatar

Level 4

Yeah - I restarted fresh with to edit the default "pdf" and in line added a new tab. Which then created the right tree in "/conf/global/settings/dam/adminui-extension/metadataschema/default/application/pdf/" and the overlap wasn't bad compared to what I was trying before. I might have been copying a higher folder such as "application" before which probably started me down the path of confusion

Avatar

Community Advisor

Hi,

Can you try using granite include?

<items jcr:primaryType="nt:unstructured">
        <tabs jcr:primaryType="nt:unstructured"
            sling:resourceType="granite/ui/components/coral/foundation/tabs"
            size="L">
            <items jcr:primaryType="nt:unstructured">
                <tab1 granite:rel="aem-assets-metadata-form-tab"
                    jcr:primaryType="nt:unstructured"
                    jcr:title="Basic"
                    sling:resourceType="granite/ui/components/coral/foundation/container"
                    listOrder="0">
                    <granite:data jcr:primaryType="nt:unstructured"
                        tabid="dd9d71ff-4524-435d-a16c-0249020660fc" />
                    <items jcr:primaryType="nt:unstructured">
                        <col1 jcr:primaryType="nt:unstructured"
                            sling:resourceType="granite/ui/components/coral/foundation/include"
                            path="/libs/dam/content/schemaeditors/forms/default/items/tabs/items/tab1/items/col1" />
                        <col2 jcr:primaryType="nt:unstructured"
                            sling:resourceType="granite/ui/components/coral/foundation/include"
                            path="/libs/dam/content/schemaeditors/forms/default/items/tabs/items/tab1/items/col2" />
                        <col3 jcr:primaryType="nt:unstructured"
                            sling:resourceType="granite/ui/components/coral/foundation/include"
                            path="/libs/dam/content/schemaeditors/forms/default/items/tabs/items/tab1/items/col3" />
                    </items>
                </tab1>
                </items>
                </tabs>
                </items>


Arun Patidar