class RightToBeForgottenDisplayTraversal in General Data Protection Regulation 3.0.x
Same name and namespace in other branches
- 8.2 modules/gdpr_tasks/src/Traversal/RightToBeForgottenDisplayTraversal.php \Drupal\gdpr_tasks\Traversal\RightToBeForgottenDisplayTraversal
- 8 modules/gdpr_tasks/src/Traversal/RightToBeForgottenDisplayTraversal.php \Drupal\gdpr_tasks\Traversal\RightToBeForgottenDisplayTraversal
Entity traversal for the right to be forgotten preview display.
@package Drupal\gdpr_tasks
Hierarchy
- class \Drupal\gdpr_fields\EntityTraversal implements EntityTraversalInterface
- class \Drupal\gdpr_tasks\Traversal\RightToBeForgottenDisplayTraversal
Expanded class hierarchy of RightToBeForgottenDisplayTraversal
1 string reference to 'RightToBeForgottenDisplayTraversal'
- gdpr_tasks.services.yml in modules/
gdpr_tasks/ gdpr_tasks.services.yml - modules/gdpr_tasks/gdpr_tasks.services.yml
File
- modules/
gdpr_tasks/ src/ Traversal/ RightToBeForgottenDisplayTraversal.php, line 15
Namespace
Drupal\gdpr_tasks\TraversalView source
class RightToBeForgottenDisplayTraversal extends EntityTraversal {
/**
* {@inheritdoc}
*
* @throws \Drupal\Component\Plugin\Exception\InvalidPluginDefinitionException
* @throws \Drupal\Core\Entity\EntityMalformedException
*/
protected function processEntity(FieldableEntityInterface $entity, GdprFieldConfigEntity $config, $row_id, GdprField $parent_config = NULL) {
$entity_type = $entity
->getEntityTypeId();
$entity_definition = $entity
->getEntityType();
$fields = $this->entityFieldManager
->getFieldDefinitions($entity_type, $entity
->bundle());
$field_configs = $config
->getFieldsForBundle($entity
->bundle());
foreach ($fields as $field_id => $field) {
$field_config = isset($field_configs[$field_id]) ? $field_configs[$field_id] : NULL;
// If the field is not configured, not enabled,
// or not enabled for RTF, then skip it.
if ($field_config === NULL || !$field_config->enabled || !in_array($field_config->rtf, [
'anonymize',
'remove',
'maybe',
])) {
continue;
}
$key = "{$entity_type}.{$entity->id()}.{$field_id}";
$this->results[$key] = [
'title' => $field
->getLabel(),
'value' => $entity
->get($field_id)
->getString(),
'entity' => $entity_definition
->getLabel(),
'bundle' => $this
->getBundleLabel($entity),
'notes' => $field_config->notes,
'gdpr_rtf' => $field_config->rtf,
'link' => $field_config->rtf == 'maybe' ? $entity
->toLink('Edit', 'edit-form') : '',
];
}
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
EntityTraversal:: |
protected | property | The starting entity for the traversal. | |
EntityTraversal:: |
protected | property | Entity storage for GDPR config entities. | |
EntityTraversal:: |
protected | property | The processed entities. | |
EntityTraversal:: |
protected | property | Entity field manager. | |
EntityTraversal:: |
protected | property | Entity type manager. | |
EntityTraversal:: |
protected | property | The results of the traversal. | |
EntityTraversal:: |
private | property | Reverse relationship information. | |
EntityTraversal:: |
protected | property | Whether or not the traversal has happened successfully. | |
EntityTraversal:: |
public static | function |
Creates an instance of the traversal for this specific entity. Overrides EntityTraversalContainerInjectionInterface:: |
1 |
EntityTraversal:: |
protected | function | Traverses the entity relationship tree. | |
EntityTraversal:: |
protected | function | Gets all reverse relationships configured in the system. | |
EntityTraversal:: |
protected | function | Gets the entity bundle label. Useful for display traversal. | |
EntityTraversal:: |
public | function | Get the calculated actual calling points. | |
EntityTraversal:: |
public | function |
Get the traversal results. Overrides EntityTraversalInterface:: |
|
EntityTraversal:: |
public | function |
Traverses the entity relationship tree if not done before. Overrides EntityTraversalInterface:: |
|
EntityTraversal:: |
protected | function | Traverses the entity relationship tree. | 1 |
EntityTraversal:: |
public | function | EntityTraversal constructor. | 1 |
RightToBeForgottenDisplayTraversal:: |
protected | function |
Overrides EntityTraversal:: |