v.5.7 - Block: call JS-Function in view from controller
Permalink
Hi there,
i am trying to call a JS Function in the view.php from the controller.php.
I am really not familiar with php ... so i tried the following (warning - ugly workaround)
and in the view
And this works! I'm sure that this is not a clean solution ... but it works.
Now comes my Problem: I want to call the JS Function when a block is deleted - in edit mode.
So i just tried the following:
But that doesn't work - to make it clear. I try to fire the JS Function after the block is deleted in the
edit mode ... its about arranging divs.
Hopefully someone has an idea how to solve this ...
Thanks in advance
Simon
i am trying to call a JS Function in the view.php from the controller.php.
I am really not familiar with php ... so i tried the following (warning - ugly workaround)
public function view() { $this->set('doTheJS', "yes"); }
and in the view
<?if(isset($doTheJS)){ ?> <script type="text/javascript"> console.log("works"); </script> <?}?>
And this works! I'm sure that this is not a clean solution ... but it works.
Now comes my Problem: I want to call the JS Function when a block is deleted - in edit mode.
So i just tried the following:
public function delete() { $this->set('doTheJS', "yes"); }
But that doesn't work - to make it clear. I try to fire the JS Function after the block is deleted in the
edit mode ... its about arranging divs.
Hopefully someone has an idea how to solve this ...
Thanks in advance
Simon