You are here

function revenue_sharing_basic_settings in Google AdSense integration 5.2

Same name and namespace in other branches
  1. 5.3 old/revenue_sharing_basic/revenue_sharing_basic.admin.inc \revenue_sharing_basic_settings()
  2. 6 old/revenue_sharing_basic/revenue_sharing_basic.admin.inc \revenue_sharing_basic_settings()
  3. 7 old/revenue_sharing_basic/revenue_sharing_basic.admin.inc \revenue_sharing_basic_settings()
1 call to revenue_sharing_basic_settings()
revenue_sharing_basic_adsense in ./revenue_sharing_basic.module

File

./revenue_sharing_basic.module, line 39

Code

function revenue_sharing_basic_settings() {
  $form = array();
  $module = 'revenue_sharing_basic';
  include_once drupal_get_path('module', $module) . '/' . $module . '_help.inc';
  $form['help'] = array(
    '#type' => 'fieldset',
    '#collapsible' => TRUE,
    '#collapsed' => TRUE,
    '#title' => t('Help and instructions'),
  );
  $help_function = $module . '_help_text';
  $form['help']['help'] = array(
    '#type' => 'markup',
    '#value' => $help_function(),
  );
  $form['required'] = array(
    '#type' => 'fieldset',
    '#collapsible' => TRUE,
    '#collapsed' => FALSE,
    '#title' => t('Required parameters'),
  );
  $form['required'][REVENUE_SHARING_BASIC_CLIENT_ID_PROFILE_FIELD] = array(
    '#type' => 'select',
    '#title' => t('Google AdSense client ID profile field'),
    '#default_value' => variable_get(REVENUE_SHARING_BASIC_CLIENT_ID_PROFILE_FIELD, 0),
    '#options' => revenue_sharing_basic_get_profile_fields(),
    '#required' => TRUE,
    '#description' => t('This is the profile field that holds the AdSense Client ID for the site owner as well as (optionally) for site users who participate in revenue sharing. You must enabled the profile module and create a new field for this.'),
  );
  $error_flag = revenue_sharing_basic_adsense('status');
  if ($error_flag) {
    return $form;
  }
  $form['revenue'] = array(
    '#type' => 'fieldset',
    '#collapsible' => TRUE,
    '#collapsed' => TRUE,
    '#title' => t('Revenue sharing options'),
  );
  $form['revenue'][REVENUE_SHARING_BASIC_ENABLE] = array(
    '#type' => 'checkbox',
    '#title' => t('Enable revenue sharing'),
    '#return_value' => 1,
    '#default_value' => variable_get(REVENUE_SHARING_BASIC_ENABLE, 0),
    '#description' => t('Note that enabling this will disable AdSense code caching, which can cause more resource usage for busy sites. The referral feature requires the referral module to be installed.'),
  );
  $form['revenue'][REVENUE_SHARING_BASIC_PERCENTAGE_AUTHOR] = array(
    '#type' => 'select',
    '#title' => t('Percentage of node views going to author'),
    '#default_value' => variable_get(REVENUE_SHARING_BASIC_PERCENTAGE_AUTHOR, 0),
    '#options' => drupal_map_assoc(array(
      0,
      5,
      10,
      15,
      20,
      25,
      30,
      40,
      50,
      60,
      70,
      75,
      80,
      90,
      100,
    )),
  );
  if (module_exists('referral')) {
    $list = drupal_map_assoc(array(
      0,
      5,
      10,
      15,
      20,
      25,
      30,
      40,
      50,
      60,
      70,
      75,
      80,
      90,
      100,
    ));
    $form['revenue'][REVENUE_SHARING_BASIC_PERCENTAGE_REFER] = array(
      '#type' => 'select',
      '#title' => t('Percentage of node views going to user who referred the author'),
      '#default_value' => variable_get(REVENUE_SHARING_BASIC_PERCENTAGE_REFER, 0),
      '#options' => $list,
      '#description' => t('This feature requires the referral module to be installed.'),
    );
  }
  $form['revenue']['content'] = array(
    '#type' => 'fieldset',
    '#collapsible' => TRUE,
    '#collapsed' => TRUE,
    '#title' => t('Content types'),
    '#description' => t('Content types that have revenue sharing enabled.'),
  );
  foreach (node_get_types() as $type => $name) {
    $form['revenue']['content'][REVENUE_SHARING_BASIC_NODE_TYPE . $type] = array(
      '#type' => 'checkbox',
      '#title' => $name->name,
      '#return_value' => 1,
      '#default_value' => variable_get(REVENUE_SHARING_BASIC_NODE_TYPE . $type, 0),
    );
  }
  return $form;
}