You are here

function social_gdpr_form_data_policy_data_policy_agreement_alter in Open Social 8.3

Same name and namespace in other branches
  1. 8.9 modules/custom/social_gdpr/social_gdpr.module \social_gdpr_form_data_policy_data_policy_agreement_alter()
  2. 8.2 modules/custom/social_gdpr/social_gdpr.module \social_gdpr_form_data_policy_data_policy_agreement_alter()
  3. 8.4 modules/custom/social_gdpr/social_gdpr.module \social_gdpr_form_data_policy_data_policy_agreement_alter()
  4. 8.5 modules/custom/social_gdpr/social_gdpr.module \social_gdpr_form_data_policy_data_policy_agreement_alter()
  5. 8.6 modules/custom/social_gdpr/social_gdpr.module \social_gdpr_form_data_policy_data_policy_agreement_alter()
  6. 8.7 modules/custom/social_gdpr/social_gdpr.module \social_gdpr_form_data_policy_data_policy_agreement_alter()
  7. 8.8 modules/custom/social_gdpr/social_gdpr.module \social_gdpr_form_data_policy_data_policy_agreement_alter()
  8. 10.3.x modules/custom/social_gdpr/social_gdpr.module \social_gdpr_form_data_policy_data_policy_agreement_alter()
  9. 10.0.x modules/custom/social_gdpr/social_gdpr.module \social_gdpr_form_data_policy_data_policy_agreement_alter()
  10. 10.1.x modules/custom/social_gdpr/social_gdpr.module \social_gdpr_form_data_policy_data_policy_agreement_alter()
  11. 10.2.x modules/custom/social_gdpr/social_gdpr.module \social_gdpr_form_data_policy_data_policy_agreement_alter()

Implements hook_form_FORM_ID_alter().

File

modules/custom/social_gdpr/social_gdpr.module, line 48
Contains social_gdpr.module.

Code

function social_gdpr_form_data_policy_data_policy_agreement_alter(&$form, FormStateInterface $form_state, $form_id) {

  // Get the active data policy and display a message that it was updated.
  $entity_id = \Drupal::config('data_policy.data_policy')
    ->get('entity_id');
  $timestamp = DataPolicy::load($entity_id)
    ->getChangedTime();
  $date = \Drupal::service('date.formatter')
    ->format($timestamp, 'social_medium_date');
  $form['date'] = [
    '#theme' => 'status_messages',
    '#message_list' => [
      'info' => [
        [
          '#type' => 'html_tag',
          '#tag' => 'strong',
          '#value' => t('Our data policy has been updated on %date', [
            '%date' => $date,
          ]),
        ],
      ],
    ],
    '#weight' => -1,
  ];
  if (isset($form['not_agree'])) {
    $form['not_agree']['#tag'] = 'small';
  }
}