You are here

function legal_display_form_element in Legal 7

Display settings form element used on T&Cs content and configuration form pages.

Parameters

$form:

2 calls to legal_display_form_element()
legal_administration in ./legal.admin.inc
Module settings form.
legal_configuration in ./legal.admin.inc
Module configuration options form.

File

./legal.admin.inc, line 225
Administration UI for the Legal module.

Code

function legal_display_form_element(&$form) {

  // Overide display setting.
  $form['display_header'] = array(
    '#type' => 'fieldset',
    '#title' => t('Display settings'),
    '#description' => t('How terms & conditions should be displayed to users.'),
    '#collapsible' => TRUE,
    '#collapsed' => TRUE,
  );
  $form['display_header']['display'] = array(
    '#type' => 'radios',
    '#title' => t('Display Style'),
    '#default_value' => variable_get('legal_display', '0'),
    '#options' => array(
      t('Scroll Box (use with Text Format: Plain Text)'),
      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('legal_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 T&Cs when a user clicks on the link.'),
    '#required' => TRUE,
    '#states' => array(
      'visible' => array(
        // action to take.
        ':input[name="display"]' => array(
          'value' => 3,
        ),
      ),
    ),
  );
}