You are here

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

Implements poptinFetchRow().

1 call to PoptinController::poptinFetchRow()
PoptinController::poptinGeneratePoptinLink in src/Controller/PoptinController.php
Implements poptinGeneratePoptinLink().

File

src/Controller/PoptinController.php, line 243

Class

PoptinController
Provides route responses for the Poptin module.

Namespace

Drupal\poptin\Controller

Code

public function poptinFetchRow() {
  $results = \Drupal::database()
    ->select('poptin', 'p')
    ->fields('p')
    ->execute();
  $results->allowRowCount = TRUE;
  $num_of_results = $results
    ->rowCount();
  if ($num_of_results > 0) {
    foreach ($results as $result) {
      return [
        'userid' => $result->user_id,
        'client_id' => $result->client_id,
        'token' => $result->token,
      ];
    }
  }
  else {
    return FALSE;
  }
}