You are here

function gdpr_consent_configuration in GDPR Consent 7

Module configuration options form.

1 string reference to 'gdpr_consent_configuration'
gdpr_consent_menu in ./gdpr_consent.module
Implements hook_menu().

File

./gdpr_consent.admin.inc, line 11
Administration UI for the GDPR Consent module.

Code

function gdpr_consent_configuration($form_state) {
  $form = array();
  $form['description'] = array(
    '#markup' => '<p>' . t('Configuration options for GDPR data processing consent acquisition.') . '</p>',
  );
  $form['gdpr_consent_accept_every_login'] = array(
    '#type' => 'checkbox',
    '#title' => t('Ask to accept data processing consent at start every login.'),
    '#description' => t('User is merely redirected  to give consent but is not forced to do so to continue to use the site. If you want to force accepted consent select the next option.'),
    '#default_value' => variable_get('gdpr_consent_accept_every_login', '0'),
  );
  $form['gdpr_consent_disallow_without'] = array(
    '#type' => 'checkbox',
    '#title' => t('Force to have accepted consent.'),
    '#description' => t('Users are not allowed to use site at all without consent.'),
    '#default_value' => variable_get('gdpr_consent_disallow_without', '0'),
  );
  $form['gdpr_consent_block_admin'] = array(
    '#type' => 'checkbox',
    '#title' => t('Prevent users from accessing admin pages without consent.'),
    '#description' => t('Prevents users without active consent from accessing admin pages (except this admin page).'),
    '#default_value' => variable_get('gdpr_consent_block_admin', '0'),
  );
  $form['gdpr_consent_nag_message'] = array(
    '#type' => 'textfield',
    '#title' => t('Nag message for forced consent approval.'),
    '#description' => t('Nag message shown to users when they are forced to accept consent.'),
    '#default_value' => variable_get('gdpr_consent_nag_message', 'You must give your consent to process your data in order to continue using our services.'),
  );
  $form['except_gdpr_consent'] = array(
    '#type' => 'fieldset',
    '#title' => t('Exempt user roles'),
    '#description' => t('Users with the selected roles will never be shown GDPR consent.'),
    '#collapsible' => TRUE,
    '#collapsed' => TRUE,
  );
  $all_roles = array_map('check_plain', user_roles());
  $irrelevant_roles = array(
    'anonymous user',
    'authenticated user',
  );
  $role_options = array_diff($all_roles, $irrelevant_roles);
  $except_roles = variable_get('gdpr_consent_except_roles', array());
  $form['except_gdpr_consent']['except_roles'] = array(
    '#type' => 'checkboxes',
    '#title' => t('Exempt user roles'),
    '#options' => $role_options,
    '#default_value' => $except_roles,
    '#description' => t('Do not display GDPR consent check box for the selected user roles.'),
  );
  gdpr_consent_display_form_element($form);
  $form['#validate'][] = 'gdpr_consent_admin_form_validate';
  $form['save'] = array(
    '#type' => 'submit',
    '#value' => t('Save'),
  );
  return $form;
}