You are here

function eu_cookie_compliance_admin_form in EU Cookie Compliance (GDPR Compliance) 5

Same name and namespace in other branches
  1. 6 eu_cookie_compliance.admin.inc \eu_cookie_compliance_admin_form()
  2. 7.2 eu_cookie_compliance.admin.inc \eu_cookie_compliance_admin_form()
  3. 7 eu_cookie_compliance.admin.inc \eu_cookie_compliance_admin_form()

Provides form for cookie control popup.

1 string reference to 'eu_cookie_compliance_admin_form'
eu_cookie_compliance_menu in ./eu_cookie_compliance.module
Implements hook_menu().

File

./eu_cookie_compliance.module, line 28
This module intends to deal with the EU Directive on Privacy and Electronic Communications that comes into effect in the UK on 26th May 2012.

Code

function eu_cookie_compliance_admin_form() {
  global $locale;
  $ln = $locale;
  $popup_settings = eu_cookie_compliance_get_settings();
  $form['eu_cookie_compliance_' . $ln] = array(
    '#type' => 'item',
    '#tree' => TRUE,
  );
  if (module_exists('locale')) {
    $form['eu_cookie_compliance_' . $ln]['#title'] = t('You are editing settings for the %language language.', array(
      '%language' => $ln,
    ));
  }
  $form['eu_cookie_compliance_' . $ln]['popup_enabled'] = array(
    '#type' => 'checkbox',
    '#title' => t('Enable popup'),
    '#default_value' => $popup_settings['popup_enabled'] ? $popup_settings['popup_enabled'] : 0,
  );
  $form['eu_cookie_compliance_' . $ln]['popup_clicking_confirmation'] = array(
    '#type' => 'checkbox',
    '#title' => t('Consent by clicking'),
    '#default_value' => isset($popup_settings['popup_clicking_confirmation']) ? $popup_settings['popup_clicking_confirmation'] : 1,
    '#description' => t('By default by clicking any link on the website the visitor accepts the cookie policy. Uncheck this box if you do not require this functionality. You may want to edit the pop-up message below accordingly.'),
  );
  $form['eu_cookie_compliance_' . $ln]['popup_position'] = array(
    '#type' => 'checkbox',
    '#title' => t('Place the pop-up at the top of the website'),
    '#default_value' => $popup_settings['popup_position'] ? $popup_settings['popup_position'] : 0,
    '#description' => t('By default the pop-up appears at the bottom of the website. Tick this box if you want it to appear at the top'),
  );
  $form['eu_cookie_compliance_' . $ln]['popup_info'] = array(
    '#type' => 'item',
    '#tree' => TRUE,
  );
  $form['eu_cookie_compliance_' . $ln]['popup_info']['value'] = array(
    '#type' => 'textarea',
    '#title' => t('Popup message - requests consent'),
    '#default_value' => $popup_settings['popup_info']['value'] ? $popup_settings['popup_info']['value'] : '',
    '#required' => TRUE,
  );
  $form['eu_cookie_compliance_' . $ln]['popup_info']['format'] = filter_form($popup_settings['popup_info']['format'], NULL, array(
    'eu_cookie_compliance_' . $ln,
    'popup_info',
    'format',
  ));
  $form['eu_cookie_compliance_' . $ln]['popup_agreed'] = array(
    '#type' => 'item',
    '#tree' => TRUE,
  );
  $form['eu_cookie_compliance_' . $ln]['popup_agreed']['value'] = array(
    '#type' => 'textarea',
    '#title' => t('Popup message - thanks for giving consent'),
    '#default_value' => $popup_settings['popup_agreed']['value'] ? $popup_settings['popup_agreed']['value'] : '',
    '#required' => TRUE,
  );
  $form['eu_cookie_compliance_' . $ln]['popup_agreed']['format'] = filter_form($popup_settings['popup_agreed']['format'], NULL, array(
    'eu_cookie_compliance_' . $ln,
    'popup_agreed',
    'format',
  ));
  $form['eu_cookie_compliance_' . $ln]['popup_link'] = array(
    '#type' => 'textfield',
    '#title' => t('Privacy policy link'),
    '#default_value' => $popup_settings['popup_link'] ? $popup_settings['popup_link'] : '',
    '#size' => 60,
    '#maxlength' => 220,
    '#required' => TRUE,
    '#description' => t('Enter link to your privacy policy or other page that will explain cookies to your users. For external links prepend http://'),
  );
  $form['eu_cookie_compliance_' . $ln]['popup_height'] = array(
    '#type' => 'textfield',
    '#title' => t('Popup height in pixels'),
    '#default_value' => $popup_settings['popup_height'] ? $popup_settings['popup_height'] : '',
    '#size' => 5,
    '#maxlength' => 5,
    '#required' => FALSE,
    '#description' => t('Enter an integer value for a desired height in pixels or leave empty for automatically adjusted height'),
  );
  $form['eu_cookie_compliance_' . $ln]['popup_width'] = array(
    '#type' => 'textfield',
    '#title' => t('Popup width in pixels or a percentage value'),
    '#default_value' => $popup_settings['popup_width'] ? $popup_settings['popup_width'] : '100%',
    '#size' => 5,
    '#maxlength' => 5,
    '#required' => TRUE,
    '#description' => t('Set the width of the popup. This can be either an integer value or percentage of the screen width. For example: 200 or 50%'),
  );
  $form['eu_cookie_compliance_' . $ln]['popup_delay'] = array(
    '#type' => 'textfield',
    '#title' => t('Popup time delay in seconds'),
    '#default_value' => $popup_settings['popup_delay'] ? $popup_settings['popup_delay'] : 1,
    '#size' => 5,
    '#maxlength' => 5,
    '#required' => TRUE,
  );
  return system_settings_form($form);
}