我在頁面屬性>基本中添加了一個新的選擇類型字段「主題」。 現在,如果我在WCM中使用相同的模板添加新頁面,那麼我也可以獲得「主題」選項,這非常明顯。 有什麼方法可以隱藏子頁面中的字段?在CQ如何禁用子頁面屬性對話框中的任何字段?
P.S這是因爲我使用相同的模板的子頁面。
我在頁面屬性>基本中添加了一個新的選擇類型字段「主題」。 現在,如果我在WCM中使用相同的模板添加新頁面,那麼我也可以獲得「主題」選項,這非常明顯。 有什麼方法可以隱藏子頁面中的字段?在CQ如何禁用子頁面屬性對話框中的任何字段?
P.S這是因爲我使用相同的模板的子頁面。
您不能使用相同的模板並使頁面屬性對話框不同。
你可以做的是超負荷的對話框
你將不得不包括在頁面的JSP代碼來獲取父頁面屬性一樣的東西:
// if the parent page is always a certain level below the root you can use
// currentPage.getAbsoluteParent(3); to get the third page down from the top
// of the current path tree.
Page parentPage = currentPage.getParent();
ValueMap parentPageProperties;
if (parentPage != null) {
parentPageProperties = parentPage.getProperties();
}
// This tries to get the property 'theme' from the current page. If that fails
// then it tries to get the property from the parent page. If that fails it
// defaults to blank.
theme = properties.get("theme", parentPageProperties.get("theme", ""));
一個快速的解決方案也將創建第二組模板/頁組成的。讓我們假設你已經有了模板,使用頁面組分B爲資源類型:
嗨,感謝您的寶貴回覆。我以其他方式實現了它。 寫一個平行於屬性的偵聽器,並使用findByType(「selection」)[i] .hide();隱藏該字段。 – OmP 2013-03-26 13:30:32
所以你想要一個屬性只能在父頁面上編輯,而不能在任何子頁面上編輯。你想要該屬性繼承到子頁面? – antonyh 2013-02-22 15:43:15