module/Paragraph/src/Grid/Paragraph/Controller/ContentController.php
public function deleteAction()
    {
        $params     = $this->params();
        $locator    = $this->getServiceLocator();
        $model      = $locator->get( 'Grid\Paragraph\Model\Paragraph\Model' );
        $paragraph  = $model->find( $params->fromRoute( 'id' ) );

        if ( empty( $paragraph ) || $paragraph->type !== 'content' )
        {
            $this->getResponse()
                 ->setStatusCode( 404 );

            return;
        }

        if ( ! $paragraph->isDeletable() )
        {
            $this->getResponse()
                 ->setStatusCode( 403 );

            return;
        }

        if ( $paragraph->delete() )
        {
            $this->messenger()
                 ->add( 'paragraph.action.delete.success',
                        'paragraph', Message::LEVEL_INFO );
        }
        else
        {
            $this->messenger()
                 ->add( 'paragraph.action.delete.failed',
                        'paragraph', Message::LEVEL_ERROR );
        }

        return $this->redirect()
                    ->toRoute( 'Grid\Paragraph\Content\List', array(
                        'locale' => (string) $this->locale(),
                    ) );
    }
public function deleteAction()
    {
        $params     = $this->params();
        $locator    = $this->getServiceLocator();
        $model      = $locator->get( 'Grid\Paragraph\Model\Paragraph\Model' );
        $paragraph  = $model->find( $params->fromRoute( 'id' ) );

        if ( empty( $paragraph ) || $paragraph->type !== 'content' )
        {
            $this->getResponse()
                 ->setStatusCode( 404 );

            return;
        }

        if ( ! $paragraph->isDeletable() )
        {
            $this->getResponse()
                 ->setStatusCode( 403 );

            return;
        }

        if ( $paragraph->delete() )
        {
            $this->messenger()
                 ->add( 'paragraph.action.delete.success',
                        'paragraph', Message::LEVEL_INFO );
        }
        else
        {
            $this->messenger()
                 ->add( 'paragraph.action.delete.failed',
                        'paragraph', Message::LEVEL_ERROR );
        }

        return $this->redirect()
                    ->toRoute( 'Grid\Paragraph\Content\List', array(
                        'locale' => (string) $this->locale(),
                    ) );
    }
public function deleteAction ( ) { $ params = $ this -> params ( ) ; $ locator = $ this -> getServiceLocator ( ) ; $ model = $ locator -> get ( 'Grid\Paragraph\Model\Paragraph\Model' ) ; $ paragraph = $ model -> find ( $ params -> fromRoute ( 'id' ) ) ; if ( empty ( $ paragraph ) || $ paragraph -> type !== 'content' ) { $ this -> getResponse ( ) -> setStatusCode ( 404 ) ; return ; } if ( ! $ paragraph -> isDeletable ( ) ) { $ this -> getResponse ( ) -> setStatusCode ( 403 ) ; return ; } if ( $ paragraph -> delete ( ) ) { $ this -> messenger ( ) -> add ( 'paragraph.action.delete.success' , 'paragraph' , Message :: LEVEL_INFO ) ; } else { $ this -> messenger ( ) -> add ( 'paragraph.action.delete.failed' , 'paragraph' , Message :: LEVEL_ERROR ) ; } return $ this -> redirect ( ) -> toRoute ( 'Grid\Paragraph\Content\List' , array ( 'locale' => ( string ) $ this -> locale ( ) , ) ) ; }
Delete a content
Delete a content