Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Taras 30 posts 151 karma points
    Feb 25, 2014 @ 21:02
    Taras
    0

    Node Save and Publish with custom event

    Hi.

    Can anybody give me advice for next issue?

    When clicking on button 'Save and Publish' Node I must call some custom method which calculate value of Node propery and set it before save. After saving the property will have this new value.

    Is it possible?

    Please any links or ideas.

    Thanks.

  • Dan Diplo 1554 posts 6205 karma points MVP 6x c-trib
    Feb 25, 2014 @ 21:06
    Dan Diplo
    100

    Sure it's possible. Check out the ContentServiceEvents documentation - http://our.umbraco.org/documentation/Reference/Events-v6/ContentService-Events

  • Taras 30 posts 151 karma points
    Feb 26, 2014 @ 14:11
    Taras
    0

    Hi, Dan Diplo.

    Thank you for the response.

    It was helpful for me.

    Also for solution I used next link

    Wrote simple like this:

    using Umbraco.Core;
    using Umbraco.Web;
    using umbraco.BusinessLogic;
    using umbraco.cms.businesslogic;
    using umbraco.cms.businesslogic.web;
    
    namespace Umbraco.Extensions.EventHandlers
    {
        public class RegisterEvents : IApplicationEventHandler
        {
            public void OnApplicationInitialized(UmbracoApplicationBase httpApplication, ApplicationContext applicationContext)
            {            
            }
    
            public void OnApplicationStarting(UmbracoApplicationBase httpApplication, ApplicationContext applicationContext)
            {
                Document.BeforePublish += Document_BeforePublish;
            }
    
            public void OnApplicationStarted(UmbracoApplicationBase httpApplication, ApplicationContext applicationContext)
            {
            }
    
            private void Document_BeforePublish(Document sender, PublishEventArgs e)
            {
                //Custom code
            }
        }
    }
    
Please Sign in or register to post replies

Write your reply to:

Draft