You are here

function poptin_page_build in Website Popups, Email Popup, Exit-Intent Popup, and Contact Forms – Poptin 7

Implements hook_page_build().

File

./poptin.module, line 112
Module for adding popups on website.

Code

function poptin_page_build(&$page) {
  if (!path_is_admin(current_path())) {
    $poptin_db = poptin_fetch_row();
    if (is_array($poptin_db) && isset($poptin_db['client_id']) && $poptin_db['client_id'] != '') {
      $client_id = filter_var($poptin_db['client_id'], FILTER_SANITIZE_STRING);
      $front_url = "https://cdn.popt.in/pixel.js?id=" . check_plain($client_id);
      $page['page_bottom']['poptin'] = array(
        '#weight' => 25,
        '#markup' => '<script id="pixel-script-poptin" src="' . $front_url . '" async="true"></script>',
      );
    }
  }
}