Wednesday 15 January 2014

Using custom sitecore data item clone notification -


I understand that when cloning the data object you can add new notification for use.

Where do you specify where the custom notification class should be used?

We display a warning on the cloned items. This trick is to use the "getContentEditorWarnings" pipeline:

  & lt; Configuration xmlns: patch = "http://www.sitecore.net/xmlconfig/" & gt; & Lt; Sitecore & gt; & Lt; Pipelines & gt; & Lt; GetContentEditorWarnings & gt; & Lt; Processor type = "example. Original item, example" patch: after = "processor [@ type = 'cccore.pipels.getcontent editor warnings notification, cccor.kernel']" / & gt; & Lt; / GetContentEditorWarnings & gt; & Lt; / Pipelines & gt; & Lt; / Sitecore & gt; & Lt; / Configuration & gt;   

Then the code for this pipeline is:

  using Sitecore.Globalization; Using Sitecore.Pipelines.GetContentEditorWarnings; Namespace example {public square original item {GetContentEditorWarningsArgs args} {var item = args.Item; If ((item == zero) || item gatclone (.) Calculation () == 0) return; Var Warning = Argument Add (); Warning. Title = "this item is cloned"; Warning. }}}   

is not really related to your question, but in this example, we use link DB to find out that the clones of the item are:

  Public stable IEnumerable & lt; Items & gt; GetClones (this item origin) {Assert.ArgumentNotNull (original, "source"); Return from link (GLOBALS.LinkDatabase.GetReferrers (original) link.GetsSourceItem () in clone where ((clone! = Zero) & amp; (clone source! = Null) & amp; amp; ; Amp; clone; source .ID == original.id) Select the clone;); }    

No comments:

Post a Comment