You are here

function popup_maker_settings_view in Popup Maker - All popup types 7

1 string reference to 'popup_maker_settings_view'
popup_maker_menu in ./popup_maker.module

File

./popup_maker.admin.inc, line 3

Code

function popup_maker_settings_view() {
  if (isset($_GET['task'])) {
    switch ($_GET['task']) {
      case 'updateApiKey':
        popup_maker_update_api_key();
        break;
      case 'refreshPopups':
        popup_maker_refresh_popups();
        break;
      case 'updateStatus':
        popup_maker_update_status();
        break;
      case 'updatePopup':
        popup_maker_update_popup();
        break;
    }
  }
  $variables = array(
    'settings' => variable_get('popup_maker_settings', array(
      'api_key' => null,
      'popups' => array(),
      'popupSettings' => array(),
      'user' => array(),
    )),
    'token' => drupal_get_token('popup_maker'),
  );
  if (isset($_GET['popupId'])) {
    $variables['edit'] = true;
    $variables['editingPopupId'] = $_GET['popupId'];
    $contentTypes = node_type_get_types();
    if (!empty($contentTypes)) {
      foreach ($contentTypes as $key => $contentType) {
        $displayRules[$key] = [];
        $nodes = node_load_multiple(array(), array(
          'type' => $key,
        ));
        foreach ($nodes as $node) {
          $displayRules[$key][$node->nid] = $node->title;
        }
      }
    }
    $variables['displayRules'] = $displayRules;
  }
  drupal_add_js(drupal_get_path('module', 'popup_maker') . '/js/admin.js', array(
    'scope' => 'footer',
  ));
  drupal_add_css(drupal_get_path('module', 'popup_maker') . '/css/admin.css');
  return theme('popup_maker_settings', $variables);
}