You are here

function legal_preview in Legal 5

Same name and namespace in other branches
  1. 6.8 legal.admin.inc \legal_preview()
  2. 6.7 legal.module \legal_preview()
  3. 7.2 legal.admin.inc \legal_preview()
  4. 7 legal.admin.inc \legal_preview()
1 string reference to 'legal_preview'
legal_administration in ./legal.module

File

./legal.module, line 244

Code

function legal_preview($form, $form_values) {
  switch ($form['display']['#value']) {
    case 1:

    // scroll box (CSS)
    case 2:

      // HTML
      $form['legal']['conditions'] = array(
        '#value' => filter_xss_admin($form['conditions']['#value']),
      );
      $form['legal']['legal_accept']['#title'] = t('<strong>Accept</strong> Terms & Conditions of Use');
      break;
    case 3:

      // Page Link
      $form['legal']['conditions'] = array(
        '#value' => ' ',
      );
      $form['legal']['legal_accept']['#title'] = 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'),
        '#value' => $form['conditions']['#value'],
        '#parents' => array(
          'legal',
        ),
        '#rows' => 10,
        '#attributes' => array(
          'readonly' => '',
        ),
      );
      $form['legal']['legal_accept']['#title'] = t('<strong>Accept</strong> Terms & Conditions of Use');
  }

  // overide additional checkboxes in preview
  if (!empty($form_values['extras'])) {
    while (list($key, $label) = each($form_values['extras'])) {
      if (empty($label)) {
        unset($form['legal'][$key]);
      }
      else {
        $form['legal'][$key]['#title'] = filter_xss_admin($label);
      }
    }
  }
  return $form;
}