Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/xml/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Xml 对一系列parsys CQ施加组件限制_Xml_Components_Aem - Fatal编程技术网

Xml 对一系列parsys CQ施加组件限制

Xml 对一系列parsys CQ施加组件限制,xml,components,aem,Xml,Components,Aem,我的页面页脚中有一系列的parsy。同时,我想通过etc/designs/projectname/content.xml对所有这些组件施加限制。这是这样的: JSP: XML: 这仅适用于parsys footerPar0,而不适用于其余部分(footerPar1、footerPar2等)。我一直在努力实现这一目标。有没有一种方法可以在循环计数结束前不重复帕西一家的名字而实现它?谢谢。我也没有找到一个优雅的方法来做这件事。一种解决方案是使用JavaScript侦听器动态删除允许的组件,并

我的页面页脚中有一系列的parsy。同时,我想通过etc/designs/projectname/content.xml对所有这些组件施加限制。这是这样的:

JSP:


XML:



这仅适用于parsys footerPar0,而不适用于其余部分(footerPar1、footerPar2等)。我一直在努力实现这一目标。有没有一种方法可以在循环计数结束前不重复帕西一家的名字而实现它?谢谢。

我也没有找到一个优雅的方法来做这件事。一种解决方案是使用JavaScript侦听器动态删除允许的组件,并将其添加回您希望允许的组件中

例如,在
/apps/foundation/components/parsys
下覆盖parsys本身,添加
\u cq\u editConfig.xml
,如:

<?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="[_clear]"
          jcr:primaryType="cq:EditConfig">

    <cq:listeners
        jcr:primaryType="cq:EditListenersConfig"
        updatecomponentlist="function(cell, allowed, componentList){
            var firstSearchPath = cell.searchPaths[0];
            var isFooterParsys = firstSearchPath.indexOf('footer/footerPar') > -1;
            if (isFooterParsys && allowed instanceof Array) {
                while(allowed.length > 0) {
                    allowed.pop(); //Remove all currently allowed components from the parsys
                }
                allowed.push('project/components/content/your-component'); //add allowed components
            }
        };"/>
</jcr:root>

显然,这是非常深远的,因为侦听器正在影响parsys的所有实例(尽管在函数中通过名称将footerPar作为目标)


如果您在这些字段中还没有实时内容,您可以创建自己的资源类型,使用parsys作为超类型,以实现更好的控制级别。

我也没有找到一种优雅的方法来做到这一点。一种解决方案是使用JavaScript侦听器动态删除允许的组件,并将其添加回您希望允许的组件中

例如,在
/apps/foundation/components/parsys
下覆盖parsys本身,添加
\u cq\u editConfig.xml
,如:

<?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="[_clear]"
          jcr:primaryType="cq:EditConfig">

    <cq:listeners
        jcr:primaryType="cq:EditListenersConfig"
        updatecomponentlist="function(cell, allowed, componentList){
            var firstSearchPath = cell.searchPaths[0];
            var isFooterParsys = firstSearchPath.indexOf('footer/footerPar') > -1;
            if (isFooterParsys && allowed instanceof Array) {
                while(allowed.length > 0) {
                    allowed.pop(); //Remove all currently allowed components from the parsys
                }
                allowed.push('project/components/content/your-component'); //add allowed components
            }
        };"/>
</jcr:root>

显然,这是非常深远的,因为侦听器正在影响parsys的所有实例(尽管在函数中通过名称将footerPar作为目标)


如果您在这些字段中还没有实时内容,您可以创建自己的资源类型,将parsys用作超类型,以实现更好的控制级别。

您好,这是一个出色的解决方案。这当然有效,但是是的,正如你所说的,这将影响到各地的帕西人,我认为这是不推荐的。不管怎样,谢谢你的另一个想法:)嗨,这是一个绝妙的解决方案。这当然有效,但是是的,正如你所说的,这将影响到各地的帕西人,我认为这是不推荐的。不管怎样,谢谢你的另一个想法:)嗨,这是一个绝妙的解决方案。这当然有效,但是是的,正如你所说的,这将影响到各地的帕西人,我认为这是不推荐的。无论如何,谢谢你的另一个想法:)
<?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="[_clear]"
          jcr:primaryType="cq:EditConfig">

    <cq:listeners
        jcr:primaryType="cq:EditListenersConfig"
        updatecomponentlist="function(cell, allowed, componentList){
            var firstSearchPath = cell.searchPaths[0];
            var isFooterParsys = firstSearchPath.indexOf('footer/footerPar') > -1;
            if (isFooterParsys && allowed instanceof Array) {
                while(allowed.length > 0) {
                    allowed.pop(); //Remove all currently allowed components from the parsys
                }
                allowed.push('project/components/content/your-component'); //add allowed components
            }
        };"/>
</jcr:root>