protected function undelete()
    {
        if($this->saveButtonPushed())
        {
            $nodeRef = $this->buildCmsNodeRef();
            $node = $nodeRef->generateNode();
            $location = 'load';

            $this->Events->trigger('NodeCmsController.undelete'.'.'.$location,
                                    $this->errors, $this->templateVars, $node);

            foreach((array)$nodeRef->getElement()->getAspects() as $aspect)
                $this->Events->trigger('NodeCmsController.@'.$aspect->Slug.'.'.'undelete'.'.'.$location,
                                        $this->errors, $this->templateVars, $node);

            if (!$node->hasTitle())
                //get default form backing object
                $node = $this->RegulatedNodeService->getByNodeRef($node->getNodeRef());

            if (empty($node))
                throw new NotFoundException('Record not found for NodeRef: '.$nodeRef);

            // check permissions
            // $this->checkUndeletePermission($node);

            $location = 'pre';
            $this->Events->trigger('NodeCmsController.undelete'.'.'.$location,
                                            $this->errors, $this->templateVars, $node);

            foreach ((array)$nodeRef->getElement()->getAspects() as $aspect)
                $this->Events->trigger('NodeCmsController.@'.$aspect->Slug.'.'.'undelete'.'.'.$location,
                                            $this->errors, $this->templateVars, $node);

            $this->getErrors()->throwOnError();

            $this->RegulatedNodeService->undelete($nodeRef);

            $location = 'post';
            $this->Events->trigger('NodeCmsController.undelete'.'.'.$location, $this->errors, $this->templateVars, $node);
            foreach ((array)$nodeRef->getElement()->getAspects() as $aspect)
                $this->Events->trigger('NodeCmsController.@'.$aspect->Slug.'.'.'undelete'.'.'.$location, $this->errors, $this->templateVars, $node);


            //redirect to edit news (action_success_view)
            return new View($this->successView(), array('slug'=> $nodeRef->getSlug()));
        }
    }
protected function undelete()
    {
        if($this->saveButtonPushed())
        {
            $nodeRef = $this->buildCmsNodeRef();
            $node = $nodeRef->generateNode();
            $location = 'load';

            $this->Events->trigger('NodeCmsController.undelete'.'.'.$location,
                                    $this->errors, $this->templateVars, $node);

            foreach((array)$nodeRef->getElement()->getAspects() as $aspect)
                $this->Events->trigger('NodeCmsController.@'.$aspect->Slug.'.'.'undelete'.'.'.$location,
                                        $this->errors, $this->templateVars, $node);

            if (!$node->hasTitle())
                //get default form backing object
                $node = $this->RegulatedNodeService->getByNodeRef($node->getNodeRef());

            if (empty($node))
                throw new NotFoundException('Record not found for NodeRef: '.$nodeRef);

            // check permissions
            // $this->checkUndeletePermission($node);

            $location = 'pre';
            $this->Events->trigger('NodeCmsController.undelete'.'.'.$location,
                                            $this->errors, $this->templateVars, $node);

            foreach ((array)$nodeRef->getElement()->getAspects() as $aspect)
                $this->Events->trigger('NodeCmsController.@'.$aspect->Slug.'.'.'undelete'.'.'.$location,
                                            $this->errors, $this->templateVars, $node);

            $this->getErrors()->throwOnError();

            $this->RegulatedNodeService->undelete($nodeRef);

            $location = 'post';
            $this->Events->trigger('NodeCmsController.undelete'.'.'.$location, $this->errors, $this->templateVars, $node);
            foreach ((array)$nodeRef->getElement()->getAspects() as $aspect)
                $this->Events->trigger('NodeCmsController.@'.$aspect->Slug.'.'.'undelete'.'.'.$location, $this->errors, $this->templateVars, $node);


            //redirect to edit news (action_success_view)
            return new View($this->successView(), array('slug'=> $nodeRef->getSlug()));
        }
    }
protected function undelete ( ) { if ( $ this -> saveButtonPushed ( ) ) { $ nodeRef = $ this -> buildCmsNodeRef ( ) ; $ node = $ nodeRef -> generateNode ( ) ; $ location = 'load' ; $ this -> Events -> trigger ( 'NodeCmsController.undelete' . '.' . $ location , $ this -> errors , $ this -> templateVars , $ node ) ; foreach ( ( array ) $ nodeRef -> getElement ( ) -> getAspects ( ) as $ aspect ) $ this -> Events -> trigger ( 'NodeCmsController.@' . $ aspect -> Slug . '.' . 'undelete' . '.' . $ location , $ this -> errors , $ this -> templateVars , $ node ) ; if ( ! $ node -> hasTitle ( ) ) //get default form backing object $ node = $ this -> RegulatedNodeService -> getByNodeRef ( $ node -> getNodeRef ( ) ) ; if ( empty ( $ node ) ) throw new NotFoundException ( 'Record not found for NodeRef: ' . $ nodeRef ) ; // check permissions // $this->checkUndeletePermission($node); $ location = 'pre' ; $ this -> Events -> trigger ( 'NodeCmsController.undelete' . '.' . $ location , $ this -> errors , $ this -> templateVars , $ node ) ; foreach ( ( array ) $ nodeRef -> getElement ( ) -> getAspects ( ) as $ aspect ) $ this -> Events -> trigger ( 'NodeCmsController.@' . $ aspect -> Slug . '.' . 'undelete' . '.' . $ location , $ this -> errors , $ this -> templateVars , $ node ) ; $ this -> getErrors ( ) -> throwOnError ( ) ; $ this -> RegulatedNodeService -> undelete ( $ nodeRef ) ; $ location = 'post' ; $ this -> Events -> trigger ( 'NodeCmsController.undelete' . '.' . $ location , $ this -> errors , $ this -> templateVars , $ node ) ; foreach ( ( array ) $ nodeRef -> getElement ( ) -> getAspects ( ) as $ aspect ) $ this -> Events -> trigger ( 'NodeCmsController.@' . $ aspect -> Slug . '.' . 'undelete' . '.' . $ location , $ this -> errors , $ this -> templateVars , $ node ) ; //redirect to edit news (action_success_view) return new View ( $ this -> successView ( ) , array ( 'slug' => $ nodeRef -> getSlug ( ) ) ) ; } }
Provides 'undelete' functionality for Nodes

@return View
Provides undelete functionality for Nodes