cancel
Showing results for 
Search instead for 
Did you mean: 

Alfresco Share Config Custom Edit Properties forms for Aspects

yash_patel_c2
Star Contributor
Star Contributor

Hi Team,

I have 2 custom types in my custom content model, 5 aspects which identifies the content and other 20-30 aspects which have different properties within it which are taken as mandatory aspects inside 5 main aspects.

Here in the system when content will be uploaded, it will have one custom type attached to it and one mainAspect will be attached to it.

Content Types

  • custom:contentType1 -1 Aspect from the mainAspect 1, 3 or 4 will be attached
  • custom:contentType2 - 1 Aspect from the mainAspect 2 or 5 will be attached

Aspects with properties

  • custom:subAspect1
  • custom:subAspect2
  • custom:subAspect3
  • ....
  • ..
  • custom:subAspect20

Aspects

  • custom:mainAspect1 - Mandatory Aspects are custom:subAspect1,custom:subAspect3,custom:subAspect4,custom:subAspect16,custom:subAspect19
  • custom:mainAspect2 - Mandatory Aspects are custom:subAspect2,custom:subAspect3,custom:subAspect6,custom:subAspect13,custom:subAspect19
  • custom:mainAspect3 - Mandatory Aspects are custom:subAspect1,custom:subAspect5,custom:subAspect8,custom:subAspect10,custom:subAspect13
  • custom:mainAspect4 - Mandatory Aspects are custom:subAspect3,custom:subAspect5,custom:subAspect9,custom:subAspect11,custom:subAspect15
  • custom:mainAspect5 - Mandatory Aspects are custom:subAspect1,custom:subAspect5,custom:subAspect14,custom:subAspect16,custom:subAspect19

Now I want to make Edit Properties forms in such a way that when I upload one content in the Alfresco and change its type to custom:contentType1 and apply custom:mainAspect3 then only properties associated with subAspects 1,5,18,10,13 should be visible as those aspects are mandatory aspects of custom:mainAspect3.

I have added seperate config files for subAspects in share-config-custom.xml

<config evaluator="aspect" condition="custom:subAspect1">
                <forms>
                        <form>
                                <field-visibility>
                                        <show id="custom:subAspect1Property1"/>
                                </field-visibility>
                                <appearance>
                                        <field id="custom:subAspect1Property1" lable-id="custom-model.subAspect1.subAspect1Property1"/>                                </appearance>
                        </form>
                </forms>
        </config>

Now I have defined such configs for all required subAspects and I can get required fields in the form but when I add some PNG files or others few OOTB aspects are attached automatically. How can I remove those properties? Or how canI configure form in such a way that only custom properties shoul be visible?

Thanks,

Yash

1 REPLY 1

sanjaybandhaniya
Elite Collaborator
Elite Collaborator

Hi,

You can try like this way.(Sorry to say I have not tested).

acme:document- Use your custom type here.

<config evaluator="node-type" condition="acme:document">
        <forms>
            <!-- Default form configuration for the cm:content type -->
            <form>
                <field-visibility>
                    <show id="cm:name"/>
                    <show id="cm:title" force="true"/>
                    <show id="cm:description" force="true"/>
                    <show id="mimetype"/>
					// Basic Metadata
                </field-visibility>
                <appearance>
                   .....
                </appearance>
            </form>
            <!-- Document Library pop-up Edit Metadata form -->
            <form id="doclib-simple-metadata">
                <field-visibility>
                    <show id="cm:name"/>
                    <show id="cm:title" force="true"/>
                    <show id="cm:description" force="true"/>
                    // Basic Metadata
                </field-visibility>
                <edit-form template="../documentlibrary/forms/doclib-simple-metadata.ftl"/>
                <appearance>
                   .......
                </appearance>
            </form>
            <!-- Document Library Inline Edit form -->
            <form id="doclib-inline-edit">
                <field-visibility>
                    <show id="cm:name"/>
                    <show id="cm:content" force="true"/>
                    <show id="cm:title" force="true"/>
                    <show id="cm:description" force="true"/>
					// Basic Metadata
                </field-visibility>
                <appearance>
                   ..........
            </form>
        </forms>
    </config>

    <!-- Create and search forms for acme:document -->
    <config evaluator="model-type" condition="acme:document">
        <forms>
            <form>
                <field-visibility>
                    <show id="cm:name"/>
                    <show id="cm:content" force="true"/>
                    <show id="cm:title" force="true"/>
                    <show id="cm:description" force="true"/>
                    <show id="mimetype"/>
                    // Basic Metadata
                </field-visibility>
                <appearance>
                    ......
                </appearance>
            </form>
        </forms>
    </config>