You are here

function gdpr_fields_entity_type_alter in General Data Protection Regulation 3.0.x

Same name and namespace in other branches
  1. 8.2 modules/gdpr_tasks/gdpr_tasks.module \gdpr_fields_entity_type_alter()
  2. 8 modules/gdpr_tasks/gdpr_tasks.module \gdpr_fields_entity_type_alter()

Implements hook_entity_type_alter().

Update entity definitions of certain entity types to be excluded from entity traversal.

File

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

Code

function gdpr_fields_entity_type_alter(array &$entity_types) {

  /** @var \Drupal\Core\Entity\EntityTypeInterface[] $entity_types */

  // Excluded entity types.
  $exlude_entity_types = [
    'gdpr_tasks',
  ];
  foreach ($exlude_entity_types as $type) {
    if (isset($entity_types[$type])) {
      $entity_types[$type]
        ->set('gdpr_entity_traversal_exclude', TRUE);
    }
  }
}