You are here

function gdpr_consent_field_settings_form in General Data Protection Regulation 7

Implements hook_field_settings_form().

File

modules/gdpr_consent/gdpr_consent.module, line 516
Contains hook implementations and shared functions.

Code

function gdpr_consent_field_settings_form($field, $instance, $has_data) {
  $settings = $field['settings'];
  $agreements = array();
  foreach (entity_load('gdpr_consent_agreement') as $agreement) {
    $agreements[$agreement->id] = $agreement->title;
  }
  $form['target_id'] = array(
    '#type' => 'select',
    '#title' => t('User consent agreement'),
    '#default_value' => isset($settings['target_id']) ? $settings['target_id'] : '',
    '#required' => FALSE,
    '#options' => $agreements,
    '#element_validate' => array(
      'element_validate_integer_positive',
    ),
    '#description' => t('The GDPR User Consent Agreement to display'),
  );
  return $form;
}