You are here

function cdn_admin_general_settings_form in CDN 7.2

Same name and namespace in other branches
  1. 6.2 cdn.admin.inc \cdn_admin_general_settings_form()

Form definition; general settings.

1 string reference to 'cdn_admin_general_settings_form'
cdn_menu in ./cdn.module
Implements hook_menu().

File

./cdn.admin.inc, line 15
Settings administration UI.

Code

function cdn_admin_general_settings_form($form, &$form_state) {
  $form = array();
  _cdn_settings_form_prepare($form, $form_state);
  $perm_url = url('admin/people/permissions', array(
    'fragment' => 'module-cdn',
  ));
  $form[CDN_STATUS_VARIABLE] = array(
    '#type' => 'radios',
    '#title' => t('Status'),
    '#description' => t("If you don't want to use the CDN to serve files to your visitors yet,\n      but you do want to see if it's working well for your site, then enable\n      testing mode.<br />Users will only get the files from the CDN if they\n      have the <a href=\"!perm-url\">%cdn-testing-mode-permission\n      permission</a>.", array(
      '!perm-url' => $perm_url,
      '%cdn-testing-mode-permission' => 'access files on CDN when in testing mode',
    )),
    '#required' => TRUE,
    '#options' => array(
      CDN_DISABLED => t('Disabled'),
      CDN_TESTING => t('Testing mode'),
      CDN_ENABLED => t('Enabled'),
    ),
    '#default_value' => variable_get(CDN_STATUS_VARIABLE, CDN_DISABLED),
  );
  $form[CDN_STATS_VARIABLE] = array(
    '#type' => 'checkbox',
    '#title' => t('Display statistics'),
    '#description' => t('Shows the CDN integration statistics of the current page, to users with
        the <a href="!perm-url">%access-per-page-statistics permission</a>.', array(
      '!perm-url' => $perm_url,
      '%access-per-page-statistics' => 'access per-page statistics',
    )),
    '#return_value' => CDN_ENABLED,
    '#default_value' => variable_get(CDN_STATS_VARIABLE, CDN_DISABLED),
    '#states' => array(
      'invisible' => array(
        ':input[name="' . CDN_STATUS_VARIABLE . '"]' => array(
          'value' => '' . CDN_DISABLED,
        ),
      ),
    ),
  );
  return system_settings_form($form);
}