function gdpr_consent_display_fields in GDPR Consent 7
Displaying fields for consent.
Parameters
array $conditions: TODO.
Return value
array TODO.
3 calls to gdpr_consent_display_fields()
- gdpr_consent_administration in ./
gdpr_consent.admin.inc - Module settings form.
- gdpr_consent_form_user_profile_form_alter in ./
gdpr_consent.module - Implements hook_form_FORM_ID_alter().
- gdpr_consent_form_user_register_form_alter in ./
gdpr_consent.module - Implements hook_form_FORM_ID_alter().
File
- ./
gdpr_consent.module, line 347 - Module file for GDPR Consent.
Code
function gdpr_consent_display_fields(array $conditions) {
$form = array();
$accept_label = theme('gdpr_consent_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('gdpr_consent_display', '1'),
);
$form['display_header']['link_target'] = array(
'#type' => 'value',
'#value' => variable_get('gdpr_consent_link_target', 'new_window'),
);
$form['gdpr_consent'] = array(
'#type' => 'fieldset',
'#weight' => 29,
);
drupal_add_library('system', 'drupal.collapse');
switch (variable_get('gdpr_consent_display', '1')) {
case 1:
$form['gdpr_consent']['conditions'] = array(
'#markup' => check_markup($conditions['conditions'], $conditions['format']),
);
if (!empty($conditions['data_details'])) {
$form['gdpr_consent']['data_container'] = array(
'#type' => 'fieldset',
'#title' => t('Details on data we collect'),
'#attributes' => array(
'class' => array(
'collapsible',
'collapsed',
),
),
);
$form['gdpr_consent']['data_container']['data_details'] = array(
'#type' => 'markup',
'#markup' => $conditions['data_details'],
'#weight' => 0,
'#prefix' => '<div class="gdpr_consent-data_details">',
'#suffix' => '</div>',
);
}
break;
case 2:
$form['gdpr_consent']['conditions'] = array(
'#markup' => '',
);
$target_link = variable_get('gdpr_consent_link_target', 'new_window');
$accept_label = theme('gdpr_consent_accept_label', array(
'link' => TRUE,
'target_link' => $target_link,
));
break;
default:
$form['gdpr_consent']['conditions'] = array(
'#type' => 'textarea',
'#title' => t('Consent'),
'#default_value' => $conditions['conditions'],
'#value' => $conditions['conditions'],
'#rows' => 10,
'#weight' => 0,
'#attributes' => array(
'readonly' => 'readonly',
),
);
if (!empty($conditions['data_details'])) {
$form['gdpr_consent']['data_container'] = array(
'#type' => 'fieldset',
'#title' => t('Details on data we collect'),
'#attributes' => array(
'class' => array(
'collapsible',
'collapsed',
),
),
);
$form['gdpr_consent']['data_container']['data_details'] = array(
'#type' => 'markup',
'#markup' => check_markup($conditions['data_details'], $conditions['format']),
'#weight' => 0,
'#prefix' => '<div class="gdpr_consent-data_details">',
'#suffix' => '</div>',
);
}
}
$form['gdpr_consent']['gdpr_consent_accept'] = array(
'#type' => 'checkbox',
'#title' => $accept_label,
'#default_value' => 0,
'#weight' => 50,
);
return $form;
}