You are here

function dynamic_banner_settings in Dynamic Banner 6

Same name and namespace in other branches
  1. 7.2 dynamic_banner.module \dynamic_banner_settings()
  2. 7 includes/callbacks.inc \dynamic_banner_settings()
  3. 8.x dynamic_banner.module \dynamic_banner_settings()

A page that will display a form for changing how dynamic banner will function

1 string reference to 'dynamic_banner_settings'
dynamic_banner_menu in ./dynamic_banner.module
Implements hook_menu().

File

includes/callbacks.inc, line 380
Dynamic Banner Admin Pages and various other functions to make them work Most of the code in this file was derived from path module

Code

function dynamic_banner_settings($form_state) {

  // todo need to find a better way of doing this
  $display_setting = variable_get('dynamic_banner_display_setting', DEFAULT_OUTPUT);
  if ($display_setting == 'url') {
    $display_current_setting = 0;
  }
  elseif ($display_setting == 'text') {
    $display_current_setting = 1;
  }
  elseif ($display_setting == 'urltext') {
    $display_current_setting = 2;
  }
  elseif ($display_setting == 'urllink') {
    $display_current_setting = 3;
  }

  // todo need to find a better way of doing this
  $errors_current_setting = 1;
  if (variable_get('dynamic_banner_display_errors', DEFAULT_ERROR)) {
    $errors_current_setting = 0;
  }
  $form['display_setting'] = array(
    '#type' => 'radios',
    '#title' => t('Display Setting'),
    '#options' => array(
      t('url'),
      t('text'),
      t('urltext'),
      t('urllink'),
    ),
    '#default_value' => $display_current_setting,
    '#description' => t('What display pattern do you want the module to
      follow in the template file'),
  );
  $form['display_errors'] = array(
    '#type' => 'radios',
    '#title' => t('Display Errors?'),
    '#options' => array(
      t('yes'),
      t('no'),
    ),
    '#default_value' => $errors_current_setting,
    '#description' => t('If dynamic banner can not find a banner for the
      current page do you want it to display an error?'),
  );
  $form['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Save'),
  );
  return $form;
}