2

I want to show some custom Error Messages as Notifications right under the toolbar in the experience editor. I've tried to implement the Alerts from Habitat but I am not shure if this is the right thing I need and I don't get it working in my local solution.

So I am trying the PageEditorNotifications, I think this could be a solution for my problem to get a message like

enter image description here

but I am not able to patch the proccessor in the right place

I need it in here:

enter image description here

but my Patchfile tries are not working. I've tried the following Patch files:

V1

  <configuration xmlns:patch="http://www.sitecore.net/xmlconfig/" xmlns:role="http://www.sitecore.net/xmlconfig/role/">
    <sitecore role:require="Standalone or ContentManagement">
      <group groupName="ExperienceEditor" name="ExperienceEditor">
        <pipelines>
          <getPageEditorNotifications>
            <processor type="Foundation.ExperienceEditor.Pipelines.ShowCustomNotifications, Foundation.ExperienceEditor" patch:after="processor[@type='Sitecore.ContentTesting.Pipelines.GetPageEditorNotifications.GetContentTestingNotifications, Sitecore.ContentTesting']" />
          </getPageEditorNotifications>
        </pipelines>
      </group>
    </sitecore>
  </configuration>

V2

<configuration xmlns:patch="sitecore.net/xmlconfig" xmlns:set="sitecore.net/xmlconfig/set">
  <sitecore>
    <pipelines>
      <getPageEditorNotifications>
        <processor type="Foundation.ExperienceEditor.Pipelines.ShowCustomNotifications, Foundation.ExperienceEditor" />
      </getPageEditorNotifications>
    </pipelines>
  </sitecore>
</configuration>

V3

<configuration xmlns:patch="sitecore.net/xmlconfig" xmlns:set="sitecore.net/xmlconfig/set">
  <sitecore>
      <getPageEditorNotifications>
        <processor type="Foundation.ExperienceEditor.Pipelines.ShowCustomNotifications, Foundation.ExperienceEditor" />
      </getPageEditorNotifications>
  </sitecore>
</configuration>

but non of them is patching the right location :-/ so that the processor get called. I am using Sitecore 9 update 2

processor code:

    namespace Foundation.ExperienceEditor.Pipelines
    {
        public class ShowCustomNotifications : GetPageEditorNotificationsProcessor
        {
            public override void Process(GetPageEditorNotificationsArgs arguments)
            {
                arguments.Notifications.Add(new PageEditorNotification("Hallo Welt", PageEditorNotificationType.Error));
            }      
        }
    }
4
  • Can you give an example of one that is already exists. Just wondering if is a rendering alert. Or like the red one you get when something goes wrong.
    – Chris Auer
    Apr 12, 2019 at 21:42
  • 1
    @ChrisAuer I've editet my question Apr 12, 2019 at 21:52
  • @squadwuschel - I think you can just patch it simply as : <configuration xmlns:patch="sitecore.net/xmlconfig" xmlns:set="sitecore.net/xmlconfig/set"> <sitecore> <pipelines> <getPageEditorNotifications> <processor type="YourSolution.YourPipeline.YourClass, YourSolution" /> </getPageEditorNotifications> </pipelines> </sitecore> </configuration> Hope this helps. Lemme know how it goes. -jb Apr 13, 2019 at 4:04
  • Nope thats not working tried All Variation so far Apr 13, 2019 at 5:22

1 Answer 1

2

It's not intuitive with pipeline processors and group configs - you need to have first pipelines, then group and then again pipelines node.

This is the correct patch file:

<?xml version="1.0" encoding="utf-8"?>
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/" xmlns:role="http://www.sitecore.net/xmlconfig/role/">
  <sitecore role:require="Standalone or ContentManagement or ContentDelivery or Reporting or Processing">
    <pipelines>
      <group groupName="ExperienceEditor" name="ExperienceEditor">
        <pipelines>
          <getPageEditorNotifications>
            <processor 
              type="Foundation.ExperienceEditor.Pipelines.ShowCustomNotifications, Foundation.ExperienceEditor" 
              patch:after="processor[@type='Sitecore.ContentTesting.Pipelines.GetPageEditorNotifications.GetContentTestingNotifications, Sitecore.ContentTesting']" />
          </getPageEditorNotifications>
        </pipelines>
      </group>
    </pipelines>
  </sitecore>
</configuration>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.