Block Controller cannot redeclare delete function

Permalink
Hi there,

i want to execute some code when a block is deleted.
But if i try to set up the delete() function in my controller i get following error message:

Cannot redeclare Application\Block\ThReferenzseite\Controller::delete()

public function delete(){
/*..*/
}

http://concrete5.org/api/class-Concrete.Core.Block.BlockController....

Somebody has an idea how i can things get to run?
Thanks in advanced
Simon

SimonGG
 
mnakalay replied on at Permalink Reply
mnakalay
I think your delete function needs to call the parent delete function first
public function delete()
    {
        parent::delete();
        // Your code
    }
SimonGG replied on at Permalink Reply
SimonGG
Thanks! But i just noticed that i defined the delete function twice in the controller.
Anyway what i tried to transpose still wont work.
Maybe you have a tip. I want execute a JS function in the view.php after a block is deleted.
I tried to set a var like so:
$this->set('doTheJS', "yes");

And then in the view.php
if(isset($doTheJS)){ ?>
  <script type="text/javascript">
    console.log("hello");
  </script>
<?}

But this wont work.

cheers Simon
mnakalay replied on at Permalink Reply
mnakalay
I think that once a block is deleted, there is nothing you can do in the view. All you can do is in the delete function.

I might be wrong though...