1
A
回答
1
我們對已克隆的項目顯示警告。訣竅是使用「getContentEditorWarnings」管道:
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
<sitecore>
<pipelines>
<getContentEditorWarnings>
<processor type="Example.OriginalItem, Example" patch:after="processor[@type='Sitecore.Pipelines.GetContentEditorWarnings.Notifications, Sitecore.Kernel']" />
</getContentEditorWarnings>
</pipelines>
</sitecore>
</configuration>
那麼對於這條管道的代碼是:
using Sitecore.Globalization;
using Sitecore.Pipelines.GetContentEditorWarnings;
namespace Example
{
public class OriginalItem
{
public void Process(GetContentEditorWarningsArgs args)
{
var item = args.Item;
if ((item == null) || item.GetClones().Count() == 0) return;
var warning = args.Add();
warning.Title = "This Item has clones";
warning.IsExclusive = false;
}
}
}
不是真的密切相關的問題,但在這個例子中,我們使用的鏈接分貝找到該物品是否有克隆:
public static IEnumerable<Item> GetClones(this Item original)
{
Assert.ArgumentNotNull(original, "source");
return (from link in Globals.LinkDatabase.GetReferrers(original)
select link.GetSourceItem() into clone
where ((clone != null) && (clone.Source != null)) && (clone.Source.ID == original.ID)
select clone);
}
相關問題
- 1. Sitecore 6.4 - 發佈克隆
- 2. 視覺區分Sitecore克隆
- 3. 克隆一個通用的ConfigurationSection沒有自定義類
- 4. 自定義CursorLoader通知數據更改
- 5. iOS本地通知自定義數據
- 6. Kentico克隆和自定義cms.file
- 7. Magento如何克隆自定義集合
- 8. 更改Sitecore 6.4中克隆項目的模板 - 克隆是否失去繼承?
- 9. Sitecore用戶角色和克隆
- 10. 通過SOAP克隆列表(定義和項目)?
- 11. TFS2013 - 使用git克隆團隊項目的構建定義
- 12. 使用自定義SSH密鑰從Atlassian Stash/BitBucket克隆
- 13. 自定義通知
- 14. 自定義通知
- 15. 克隆類定義(PCL)
- 16. C#克隆通用
- 17. 通知API - 自定義選項?
- 18. 自定義電子郵件通知與鏈接 - sitecore
- 19. 數據集克隆
- 20. 使用xamarin.android創建自定義通知
- 21. Sitecore:自定義treelistform
- 22. Sitecore的自定義項驗證
- 23. 使用SQL克隆數據庫中
- 24. 使用ZF1克隆數據庫記錄
- 25. 通過克隆
- 26. 用Hibernate克隆表的定義(hbm2ddl)
- 27. 如何使用http來克隆克隆?
- 28. 使用數組 - 克隆
- 29. sitecore xpath查詢,排除克隆的項目
- 30. Java在自定義克隆期間檢測循環引用