You are here

function gdpr_consent_display_form_element in GDPR Consent 7

Display settings form element.

Parameters

array $form: Form data as array.

2 calls to gdpr_consent_display_form_element()
gdpr_consent_administration in ./gdpr_consent.admin.inc
Module settings form.
gdpr_consent_configuration in ./gdpr_consent.admin.inc
Module configuration options form.

File

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

Code

function gdpr_consent_display_form_element(array &$form) {

  // Override display setting.
  $form['display_header'] = array(
    '#type' => 'fieldset',
    '#title' => t('Display settings'),
    '#description' => t('How data processing consent should be displayed to users.'),
    '#collapsible' => TRUE,
    '#collapsed' => TRUE,
  );
  $form['display_header']['display'] = array(
    '#type' => 'radios',
    '#title' => t('Display style'),
    '#default_value' => variable_get('gdpr_consent_display', '1'),
    '#options' => array(
      t('Scroll box (CSS - can include HTML)'),
      t('HTML text'),
      t('Link'),
    ),
    '#required' => TRUE,
  );
  $link_target_options = array(
    'new_window' => t('New window'),
  );
  $link_target_value = variable_get('gdpr_consent_link_target', 'new_window');
  if (module_exists('lightbox2')) {
    $link_target_options['lightbox2'] = t('Lightbox2 overlay');
  }
  elseif ($link_target_value == 'lightbox2') {
    $link_target_value = 'new_window';
  }
  $form['display_header']['link_target'] = array(
    '#type' => 'radios',
    '#title' => t('Link target'),
    '#default_value' => $link_target_value,
    '#options' => $link_target_options,
    '#description' => t('How to display the consent when a user clicks on the link.'),
    '#required' => TRUE,
    '#states' => array(
      'visible' => array(
        // Action to take.
        ':input[name="display"]' => array(
          'value' => 3,
        ),
      ),
    ),
  );
}