function legal_display_fields in Legal 7
Same name and namespace in other branches
- 8 legal.module \legal_display_fields()
- 5 legal.module \legal_display_fields()
- 6.8 legal.module \legal_display_fields()
- 6.7 legal.module \legal_display_fields()
- 7.2 legal.module \legal_display_fields()
- 2.0.x legal.module \legal_display_fields()
4 calls to legal_display_fields()
- legal_administration in ./
legal.admin.inc - Module settings form.
- legal_form_user_profile_form_alter in ./
legal.module - Implements hook_form_FORM_ID_alter().
- legal_form_user_register_form_alter in ./
legal.module - Implements hook_form_FORM_ID_alter().
- legal_login in ./
legal.module - Require registered users to accept new T&C.
File
- ./
legal.module, line 127 - Module file for Legal.
Code
function legal_display_fields($conditions) {
$form = array();
$accept_label = theme('legal_accept_label');
$form['current_id'] = array(
'#type' => 'value',
'#value' => $conditions['version'],
);
$form['language_value'] = array(
'#type' => 'value',
'#value' => $conditions['language'],
);
$form['revision_id'] = array(
'#type' => 'value',
'#value' => $conditions['revision'],
);
$form['current_date'] = array(
'#type' => 'value',
'#value' => $conditions['date'],
);
$form['display_header'] = array(
'#type' => 'value',
);
$form['display_header']['display'] = array(
'#type' => 'value',
'#value' => variable_get('legal_display', '0'),
);
$form['display_header']['link_target'] = array(
'#type' => 'value',
'#value' => variable_get('legal_link_target', 'new_window'),
);
$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(
'#markup' => check_markup($conditions['conditions'], $conditions['format']),
);
break;
case 3:
// Page Link.
$form['legal']['conditions'] = array(
'#markup' => '',
);
$target_link = variable_get('legal_link_target', 'new_window');
$accept_label = theme('legal_accept_label', array(
'link' => TRUE,
'target_link' => $target_link,
));
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' => 'readonly',
),
);
}
if (!empty($conditions['extras'])) {
foreach ($conditions['extras'] as $key => $label) {
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;
}