You are here

function gdpr_tasks_entity_view_alter in General Data Protection Regulation 8

Same name and namespace in other branches
  1. 8.2 modules/gdpr_tasks/gdpr_tasks.module \gdpr_tasks_entity_view_alter()
  2. 3.0.x modules/gdpr_tasks/gdpr_tasks.module \gdpr_tasks_entity_view_alter()

Implements hook_entity_view_alter().

File

modules/gdpr_tasks/gdpr_tasks.module, line 168
Module file for the GDPR Tasks module.

Code

function gdpr_tasks_entity_view_alter(&$build, EntityInterface $entity, EntityDisplayInterface $display) {
  if ($entity
    ->bundle() === 'gdpr_sar') {
    if (isset($build['sar_export']) && \in_array($entity
      ->getStatus(), [
      'reviewing',
      'processed',
    ])) {
      unset($build['sar_export']);
    }
    elseif (isset($build['sar_export_parts'])) {
      unset($build['sar_export_parts']);
    }
  }
}