Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn More

View all

Sign in to view all badges

Disable sub components from admin

Avatar

Avatar
Boost 1
Level 1
lwang
Level 1

Like

1 like

Total Posts

18 posts

Correct Reply

0 solutions
Top badges earned
Boost 1
View profile

Avatar
Boost 1
Level 1
lwang
Level 1

Like

1 like

Total Posts

18 posts

Correct Reply

0 solutions
Top badges earned
Boost 1
View profile
lwang
Level 1

22-03-2021

Hello everyone, 

 

I have a master component which contains a list of subcomponents. All of the them are custom components. I now working on a task to disable some of the subcomponents. I don't want to just delete them but rather to hide them from the admin. I know I can do so from the content policy configuration through the design dialog. But I want to do this through the code. I was wondering if anyone can point me to the right direction, such as the specific the file path and what I need to modify. I tried to search online but couldn't find anything. Thanks in advance for your help. 

 

Lucy

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar
Establish
MVP
BrianKasingli
MVP

Likes

612 likes

Total Posts

590 posts

Correct Reply

230 solutions
Top badges earned
Establish
Ignite 1
Give Back 5
Give Back 3
Give Back 10
View profile

Avatar
Establish
MVP
BrianKasingli
MVP

Likes

612 likes

Total Posts

590 posts

Correct Reply

230 solutions
Top badges earned
Establish
Ignite 1
Give Back 5
Give Back 3
Give Back 10
View profile
BrianKasingli
MVP

22-03-2021

@lwang, there are three ways that I have done this in the past.

1. Just making sure that your componentGroup is set to .hidden

 

<?xml version="1.0" encoding="UTF-8"?>
<jcr:root xmlns:cq="http://www.day.com/jcr/cq/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0"
    jcr:primaryType="cq:Component"
    jcr:title="Image Carousel"
    jcr:description="Image Carousel Component for Content Creation"
    componentGroup=".hidden"/>

 


2. Just making sure your sub-components have a unique componentGroup name, and then using the "cq:EditListenersConfig" configuration, to update the components list.

 

<?xml version="1.0" encoding="UTF-8"?>
<jcr:root xmlns:cq="http://www.day.com/jcr/cq/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0"
    cq:actions="[edit]"
    cq:dialogMode="floating"
    cq:disableTargeting="{Boolean}true"
    jcr:primaryType="cq:EditConfig">
    <cq:listeners
    	jcr:primaryType="cq:EditListenersConfig"
        updatecomponentlist="function(a,b) {
            b.length = 0;
            b.push('/apps/my-site/components/content/carousels/imagecarousel');
            b.push('/apps/my-site/components/content/carousels/tabbedcarousel');
        }"/>
</jcr:root>

 

3. If your parent component is a parsys, then you can add policies to that parsys within editable templates!

Options 1 or 2, a code deployment must be made if you want to enable or disable sub-components of a component. 

Answers (2)

Answers (2)

Avatar

Avatar
Establish
Level 4
Rohit_Utreja
Level 4

Likes

44 likes

Total Posts

45 posts

Correct Reply

15 solutions
Top badges earned
Establish
Give Back 3
Give Back
Boost 5
Boost 3
View profile

Avatar
Establish
Level 4
Rohit_Utreja
Level 4

Likes

44 likes

Total Posts

45 posts

Correct Reply

15 solutions
Top badges earned
Establish
Give Back 3
Give Back
Boost 5
Boost 3
View profile
Rohit_Utreja
Level 4

22-03-2021

Hi @lwang,

 

If you don't want to show this specific set of components to admin, I assume that these sub-components will not be exposed to any other user as well.

 

In this case, you can add componentGroup as ".hidden" in the component properties.'

 

https://experienceleague.adobe.com/docs/experience-manager-64/developing/components/components-basic...

 

Avatar

Avatar
Boost 100
Level 7
rush_pawan
Level 7

Likes

120 likes

Total Posts

192 posts

Correct Reply

77 solutions
Top badges earned
Boost 100
Validate 1
Ignite 1
Give Back 5
Give Back 3
View profile

Avatar
Boost 100
Level 7
rush_pawan
Level 7

Likes

120 likes

Total Posts

192 posts

Correct Reply

77 solutions
Top badges earned
Boost 100
Validate 1
Ignite 1
Give Back 5
Give Back 3
View profile
rush_pawan
Level 7

22-03-2021

Hello,

 

the best way to avoid admin conflict is to move under new group like .hidden or hidden which gives perfect sense to admin and supported by AEM both classic and touch

 

set property at component node level as

 

componentGroup     String          .hidden or hidden

 

Thanks!!