public static function onPreUpdate(Event $event)
    {
        $page = $event->getTarget();
        $eventArgs = $event->getEventArgs();

        if ($eventArgs instanceof PreUpdateEventArgs) {
            if ($eventArgs->hasChangedField('_workflow_state')) {
                $old = $eventArgs->getOldValue('_workflow_state');
                $new = $eventArgs->getNewValue('_workflow_state');

                if (null !== $new && null !== $listener = $new->getListenerInstance()) {
                    $listener->switchOnState($event);
                }

                if (null !== $old && null !== $listener = $old->getListenerInstance()) {
                    $listener->switchOffState($event);
                }
            }

            if ($eventArgs->hasChangedField('_state')) {
                if (
                    !($eventArgs->getOldValue('_state') & Page::STATE_ONLINE)
                    && $eventArgs->getNewValue('_state') & Page::STATE_ONLINE
                ) {
                    $event->getDispatcher()->triggerEvent('putonline', $page);
                } elseif (
                    $eventArgs->getOldValue('_state') & Page::STATE_ONLINE
                    && !($eventArgs->getNewValue('_state') & Page::STATE_ONLINE)
                ) {
                    $event->getDispatcher()->triggerEvent('putoffline', $page);
                }
            }
        }
    }
public static function onPreUpdate(Event $event)
    {
        $page = $event->getTarget();
        $eventArgs = $event->getEventArgs();

        if ($eventArgs instanceof PreUpdateEventArgs) {
            if ($eventArgs->hasChangedField('_workflow_state')) {
                $old = $eventArgs->getOldValue('_workflow_state');
                $new = $eventArgs->getNewValue('_workflow_state');

                if (null !== $new && null !== $listener = $new->getListenerInstance()) {
                    $listener->switchOnState($event);
                }

                if (null !== $old && null !== $listener = $old->getListenerInstance()) {
                    $listener->switchOffState($event);
                }
            }

            if ($eventArgs->hasChangedField('_state')) {
                if (
                    !($eventArgs->getOldValue('_state') & Page::STATE_ONLINE)
                    && $eventArgs->getNewValue('_state') & Page::STATE_ONLINE
                ) {
                    $event->getDispatcher()->triggerEvent('putonline', $page);
                } elseif (
                    $eventArgs->getOldValue('_state') & Page::STATE_ONLINE
                    && !($eventArgs->getNewValue('_state') & Page::STATE_ONLINE)
                ) {
                    $event->getDispatcher()->triggerEvent('putoffline', $page);
                }
            }
        }
    }
public static function onPreUpdate ( Event $ event ) { $ page = $ event -> getTarget ( ) ; $ eventArgs = $ event -> getEventArgs ( ) ; if ( $ eventArgs instanceof PreUpdateEventArgs ) { if ( $ eventArgs -> hasChangedField ( '_workflow_state' ) ) { $ old = $ eventArgs -> getOldValue ( '_workflow_state' ) ; $ new = $ eventArgs -> getNewValue ( '_workflow_state' ) ; if ( null !== $ new && null !== $ listener = $ new -> getListenerInstance ( ) ) { $ listener -> switchOnState ( $ event ) ; } if ( null !== $ old && null !== $ listener = $ old -> getListenerInstance ( ) ) { $ listener -> switchOffState ( $ event ) ; } } if ( $ eventArgs -> hasChangedField ( '_state' ) ) { if ( ! ( $ eventArgs -> getOldValue ( '_state' ) & Page :: STATE_ONLINE ) && $ eventArgs -> getNewValue ( '_state' ) & Page :: STATE_ONLINE ) { $ event -> getDispatcher ( ) -> triggerEvent ( 'putonline' , $ page ) ; } elseif ( $ eventArgs -> getOldValue ( '_state' ) & Page :: STATE_ONLINE && ! ( $ eventArgs -> getNewValue ( '_state' ) & Page :: STATE_ONLINE ) ) { $ event -> getDispatcher ( ) -> triggerEvent ( 'putoffline' , $ page ) ; } } } }
Occur on nestednode.page.preupdate events.

@access public

@param Event $event
Occur on nestednode . page . preupdate events .