3 Replies Latest reply on Jun 20, 2013 12:37 PM by adamyocum

    Disabling the "Target" context menu item in AEM v5.6


      Is it possible to disable the "Target" context menu item on components in AEM v5.6?  We don't want (at the moment) authors to have this ability and it seems to be interfering with some of our custom rendering code.  We're in the process of upgrading to 5.6 and we'd like to disable this feature for now until we can identify and resolve the issues we're having with it.



        • 1. Re: Disabling the "Target" context menu item in AEM v5.6
          Sham HC Level 7

          Hi levida,


          You can disable at component level by setting cq:editConfig/cq:disableTargeting to true.






          • 2. Re: Disabling the "Target" context menu item in AEM v5.6
            msulliva Level 2

            I did this on a semi-global level by adding the cq:disableTargeting to the cq:childEditConfig to the parsys and iparsys, which I overlaid under /app/foundation/components/parsys.


            The iparsys is more complicated because you would probably need to copy over the cq:editConfig and cq:childEditConfig from the iparsys in /libs.


            Also any other components that had a childEditConfig would override the setting from parsys, which would also need to be disabled, but this substantially cut down on the number of places I needed to set this.


            Here are my parsys settings /apps/foundation/components/parsys



                "jcr:title":"Paragraph System",





                "cq:childEditConfig": {

                    "cq:disableTargeting": true,

                    "jcr:primaryType": "cq:EditConfig"


                "cq:editConfig": {

                    "cq:disableTargeting": true,

                    "jcr:primaryType": "cq:EditConfig"




            • 3. Re: Disabling the "Target" context menu item in AEM v5.6

              We also just ran into an issue with the Target functionality.  Some of our components would fail if it was enabled on them by right clicking and then hitting the Target button in the context menu or using the button on the Toolbar.  Also we are not using this 'Target' feature of CQ.  So I first evauluated doing overlays and setting the cq:disableTargeting option in the editConfig nodes of parsys and iparsys, but soon found that did not cover all of our components and seemed like a lot of overlaying to disable this feature, cluttering our codebase.  I'm sure there are other ways and maybe even more graceful or clean ways but my solution was to overlay one file /libs/cq/ui/widgets/source/widgets/wcm/EditBase.js in /apps/cq/ui/widgets/source/widgets/wcm/EditBase.js and then I just added one line of code.  If you search the js file for addTargetingActions you will find the function that adds the button to the toolbar.  A config object is passed into the function.  If you add one line at the beginning of the funtion just below line 1728...


              config.disableTargeting = true;


              that will 'override' the feature by keeping the button from being shown at all in any component without having to edit all your components or do overlays of parsys etc.  It does add the problem that when you upgrade you will have to make sure you don't need to update this file, but I saw it as a trade-off to doing multiple overlays.  Hopefully this feature will be configurable at an administrative level in the future, but until then this will have to do


              Best Regards,

              Adam Yocum

              PSU Libraries