You are here

public function PoptinController::poptinDeactivate in Website Popups, Email Popup, Exit-Intent Popup, and Contact Forms – Poptin 8

Implements poptinDeactivate().

1 string reference to 'PoptinController::poptinDeactivate'
poptin.routing.yml in ./poptin.routing.yml
poptin.routing.yml

File

src/Controller/PoptinController.php, line 82

Class

PoptinController
Provides route responses for the Poptin module.

Namespace

Drupal\poptin\Controller

Code

public function poptinDeactivate(Request $request) {
  $token = $request->request
    ->get('csrftoken');
  if (!$this
    ->poptinCheckToken($token)) {
    $tmp_arr = [
      'mssg' => "Invalid CSRF TOKEN",
      'status' => 0,
      'token' => $this
        ->poptinGetToken(),
    ];
    die(Json::encode($tmp_arr));
  }
  \Drupal::database()
    ->truncate('poptin')
    ->execute();
  $tmp_arr = [
    'mssg' => "done",
    'status' => 1,
    'token' => $this
      ->poptinGetToken(),
  ];
  die(Json::encode($tmp_arr));
}