我正在嘗試爲簡單的手風琴創建一個組件,其中內容塊位於標題下,一次只能顯示一個標題。我的首選實現使用兩個組件,一個用於表示整個手風琴,另一個用於單個條目。Adobe CQ Components限制兒童組件
這個想法是,內容作者可以從sidekick中拉出手風琴,然後將一個或多個手風琴項目放入手風琴中,但不允許在此處放置任何其他組件。手風琴項目應該只能放入手風琴組件中,而不能放在其他任何分析儀中。
我的問題是,目前可以將其他內容添加到手風琴中並在手風琴之外添加手風琴項目。
要解決的第一次嘗試,這是:
foobar/components/accordion
foobar/components/accordion/accordion.jsp
foobar/components/accordion/cq:editConfig
foobar/components/accordion/dialog
foobar/components/accordion/accordionitem
foobar/components/accordion/accordionitem/accordionitem.jsp
foobar/components/accordion/accordionitem/cq:editConfig
foobar/components/accordion/accordionitem/dialog
這些都是從這個配置文件:
手風琴/ .content.xml
<jcr:root xmlns:sling="http://sling.apache.org/jcr/sling/1.0"
xmlns:cq="http://www.day.com/jcr/cq/1.0"
xmlns:jcr="http://www.jcp.org/jcr/1.0"
cq:isContainer="{Boolean}true"
jcr:primaryType="cq:Component"
jcr:title="Accordion"
sling:resourceSuperType="foundation/components/parbase"
allowedChildren="[*/accordion/accordionitem]"
allowedParents="[*/parsys]"
componentGroup="General"/>
手風琴/ _cq_editConfig.xml
<jcr:root xmlns:cq="http://www.day.com/jcr/cq/1.0"
xmlns:jcr="http://www.jcp.org/jcr/1.0"
cq:actions="[-,edit,-,delete]"
cq:layout="editbar"
jcr:primaryType="cq:EditConfig">
<cq:listeners
jcr:primaryType="cq:EditListenersConfig"
aftercopy="REFRESH_PAGE"
afterdelete="REFRESH_PAGE"
afterinsert="REFRESH_PAGE"/>
</jcr:root>
該對話框是空白的,只存在於組件將出現在夥伴中。
accordion.jsp只包含基礎解析。
手風琴/ accordionitem/.content.xml
<jcr:root xmlns:sling="http://sling.apache.org/jcr/sling/1.0"
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="Accordion Item"
sling:resourceSuperType="foundation/components/parbase"
allowedParents="[*/accordion]"
componentGroup="General"/>
手風琴項目對話框需要的稱號。 editConfig只是添加工具欄,但沒有監聽器。
accordionitem.jsp輸出從對話框中取得的標題,並具有解析。
我的問題似乎是parsys沒有使用手風琴和accordionitem組件的規則。相反,他們似乎從下一個解析繼承,而不是覆蓋。
我可以在頁面上使用編輯模式,然後選擇相應的組件設置正確的成分,但是,設置對模板的信息,這意味着我需要執行相同的配置爲每個頁面模板。我想要的是讓它在組件定義中定義,以便它存在一次。
先寫我發現這個博客,描述如出一轍之情況組件後:http://jenikya.com/blog/2012/03/cq5-accordion-component.html
使用,作爲我參考,我嘗試添加parsys的延伸,而不是accordion.jsp內使用。這對代碼沒有任何影響,所以即使我的自定義parsys也允許添加手風琴項目以外的組件。
任何指導,在任什麼是採取將不勝感激錯誤或其他方法。
您是否可以詳細瞭解如何在獲取組件後來自您的多字段的值? –