# Restrict component usage in certain container

**URL:** <https://community.bloomreach.com/t/restrict-component-usage-in-certain-container/1628>\
**Category:** Experience Manager (PaaS/OnPrem)\
**Created:** [December 12, 2019, 3:04pm UTC](https://community.bloomreach.com/t/restrict-component-usage-in-certain-container/1628 "2019-12-12T15:04:07Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![dvdgiessen](https://yyz1.discourse-cdn.com/flex027/user_avatar/community.bloomreach.com/dvdgiessen/32/569_2.png) [@dvdgiessen](https://community.bloomreach.com/u/dvdgiessen)\
**Post date:** [December 12, 2019, 3:04pm UTC](https://community.bloomreach.com/t/restrict-component-usage-in-certain-container/1628/1 "2019-12-12T15:04:07Z")

</div>

Our client currently has multiple containers where components can be added.

One of their containers is the footer container and they have a request to block the inclusion of certain components inside of that container.

Is there anyway i can make a change in the configuration to exclude certain components to be added?  
Or when rendering a component, is there a way to determine the container the component is placed in to inform the content author that he/she should move the component to another container.

```
/footer:
    jcr:primaryType: hst:component
    hst:template: base-footer
    /container:
      jcr:primaryType: hst:containercomponentreference
      hst:referencecomponent: base/footer
```

---

<div class="post-metadata">

**Author:** ![Gian-Luca.Beck](https://yyz1.discourse-cdn.com/flex027/user_avatar/community.bloomreach.com/gian-luca.beck/32/736_2.png) [@Gian-Luca.Beck](https://community.bloomreach.com/u/Gian-Luca.Beck)\
**Post date:** [June 4, 2020, 9:27am UTC](https://community.bloomreach.com/t/restrict-component-usage-in-certain-container/1628/2 "2020-06-04T09:27:26Z")

</div>

@dvdgiessen Hello, your post is a few months old now. Did you find the answer? I have exactly the same question. Thank you in advance!

---

<div class="post-metadata">

**Author:** ![Lef\_Karamoulas](https://yyz1.discourse-cdn.com/flex027/user_avatar/community.bloomreach.com/lef_karamoulas/32/82_2.png) [@Lef\_Karamoulas](https://community.bloomreach.com/u/Lef_Karamoulas)\
**Post date:** [June 4, 2020, 9:56am UTC](https://community.bloomreach.com/t/restrict-component-usage-in-certain-container/1628/3 "2020-06-04T09:56:54Z")

</div>

Hello both,

unfortunately, this is not a supported functionality at the moment.

Kind regards,  
Lef

---

<div class="post-metadata">

**Author:** ![Gian-Luca.Beck](https://yyz1.discourse-cdn.com/flex027/user_avatar/community.bloomreach.com/gian-luca.beck/32/736_2.png) [@Gian-Luca.Beck](https://community.bloomreach.com/u/Gian-Luca.Beck)\
**Post date:** [June 4, 2020, 10:01am UTC](https://community.bloomreach.com/t/restrict-component-usage-in-certain-container/1628/4 "2020-06-04T10:01:29Z")

</div>

Hello Lef,

thank you for your fast response. Is it possible to filter the usable/allowed components on a page- or at least user-role-level?

Thank you and best regards  
Gian-Luca

---

<div class="post-metadata">

**Author:** ![Lef\_Karamoulas](https://yyz1.discourse-cdn.com/flex027/user_avatar/community.bloomreach.com/lef_karamoulas/32/82_2.png) [@Lef\_Karamoulas](https://community.bloomreach.com/u/Lef_Karamoulas)\
**Post date:** [June 4, 2020, 10:34am UTC](https://community.bloomreach.com/t/restrict-component-usage-in-certain-container/1628/5 "2020-06-04T10:34:29Z")

</div>

Hello,

if you are referring to filter/restrict drag & drop components from the sidebar for editors in the CMS while editing/previewing I am afraid not.

You could have a look [here](https://documentation.bloomreach.com/library/concepts/miscellaneous/component-filtering.html) this page describes how you can filter out components entirely from the page structure. However, this applies during rendering/aggregation phase of the site. Not sure if that’s what you are after.

HTH and regards,  
Lef

---

<div class="post-metadata">

**Author:** ![dvdgiessen](https://yyz1.discourse-cdn.com/flex027/user_avatar/community.bloomreach.com/dvdgiessen/32/569_2.png) [@dvdgiessen](https://community.bloomreach.com/u/dvdgiessen)\
**Post date:** [June 4, 2020, 10:53am UTC](https://community.bloomreach.com/t/restrict-component-usage-in-certain-container/1628/6 "2020-06-04T10:53:59Z")

</div>

Currently a BR support ticket is set in place to have this implemented, they cannot give any estimates when this is done.

As a quick workaround we just don’t render any illegal component when placed in containers they are not supposed to be added to in the Site perspective.

This CMS perspective will display a warning that the content author should remove the component.

You can determine whether a component is placed in a certain container by using  
component.getComponentConfiguration().getCanonicalPath()

This path also contain the name of the container.

It’s probably not a 100% foolproof but it works good enough for our usecase.

---

<div class="post-metadata">

**Author:** ![Gian-Luca.Beck](https://yyz1.discourse-cdn.com/flex027/user_avatar/community.bloomreach.com/gian-luca.beck/32/736_2.png) [@Gian-Luca.Beck](https://community.bloomreach.com/u/Gian-Luca.Beck)\
**Post date:** [June 4, 2020, 11:04am UTC](https://community.bloomreach.com/t/restrict-component-usage-in-certain-container/1628/7 "2020-06-04T11:04:23Z")

</div>

Hi, that’s a good workaround! Thank you for sharing.
