You are here

function legal_display_fields in Legal 5

Same name and namespace in other branches
  1. 8 legal.module \legal_display_fields()
  2. 6.8 legal.module \legal_display_fields()
  3. 6.7 legal.module \legal_display_fields()
  4. 7.2 legal.module \legal_display_fields()
  5. 7 legal.module \legal_display_fields()
  6. 2.0.x legal.module \legal_display_fields()
3 calls to legal_display_fields()
legal_administration in ./legal.module
legal_login in ./legal.module
legal_user in ./legal.module

File

./legal.module, line 59

Code

function legal_display_fields($conditions) {
  $form = array();
  $accept_label = t('<strong>Accept</strong> Terms & Conditions of Use');
  $form['current_id'] = array(
    '#type' => 'value',
    '#value' => $conditions['tc_id'],
  );
  $form['current_date'] = array(
    '#type' => 'value',
    '#value' => $conditions['date'],
  );
  $form['display'] = array(
    '#type' => 'value',
    '#value' => variable_get('legal_display', '0'),
  );
  $form['legal'] = array(
    '#type' => 'fieldset',
    '#title' => t('Terms and Conditions of Use'),
    '#weight' => 29,
  );
  switch (variable_get('legal_display', '0')) {
    case 1:

    // scroll box (CSS)
    case 2:

      // HTML
      $form['legal']['conditions'] = array(
        '#value' => filter_xss_admin($conditions['conditions']),
      );
      break;
    case 3:

      // Page Link
      $form['legal']['conditions'] = array(
        '#value' => ' ',
      );
      $accept_label = t('<strong>Accept</strong> !terms of Use', array(
        '!terms' => l('Terms & Conditions', 'legal'),
      ));
      break;
    default:

      // scroll box (HTML)
      $form['legal']['conditions'] = array(
        '#type' => 'textarea',
        '#title' => t('Terms & Conditions'),
        '#default_value' => $conditions['conditions'],
        '#value' => $conditions['conditions'],
        '#rows' => 10,
        '#weight' => 0,
        '#attributes' => array(
          'readonly' => '',
        ),
      );
  }
  if (!empty($conditions['extras'])) {
    while (list($key, $label) = each($conditions['extras'])) {
      if (!empty($label)) {
        $form['legal'][$key] = array(
          '#type' => 'checkbox',
          '#title' => filter_xss_admin($label),
          '#default_value' => 0,
          '#weight' => 2,
          '#required' => TRUE,
        );
      }
    }
  }
  $form['legal']['legal_accept'] = array(
    '#type' => 'checkbox',
    '#title' => $accept_label,
    '#default_value' => 0,
    '#weight' => 50,
    '#required' => TRUE,
  );
  return $form;
}