You are here

private function ConsentWidget::getConsentingUser in General Data Protection Regulation 8

Same name and namespace in other branches
  1. 8.2 modules/gdpr_consent/src/Plugin/Field/FieldWidget/ConsentWidget.php \Drupal\gdpr_consent\Plugin\Field\FieldWidget\ConsentWidget::getConsentingUser()
  2. 3.0.x modules/gdpr_consent/src/Plugin/Field/FieldWidget/ConsentWidget.php \Drupal\gdpr_consent\Plugin\Field\FieldWidget\ConsentWidget::getConsentingUser()

Gets the user who the consent will be stored against.

Parameters

\Drupal\Core\Field\FieldItemListInterface $items: The field.

Return value

\Drupal\user\Entity\User The user

Throws

\Exception

1 call to ConsentWidget::getConsentingUser()
ConsentWidget::formElement in modules/gdpr_consent/src/Plugin/Field/FieldWidget/ConsentWidget.php
Returns the form for a single field widget.

File

modules/gdpr_consent/src/Plugin/Field/FieldWidget/ConsentWidget.php, line 219

Class

ConsentWidget
Plugin implementation of the 'gdpr_consent_widget' widget.

Namespace

Drupal\gdpr_consent\Plugin\Field\FieldWidget

Code

private function getConsentingUser(FieldItemListInterface $items) {
  $definition = $items
    ->getFieldDefinition();
  $resolver = $this->gdprConsentResolverManager
    ->getForEntityType($definition
    ->getTargetEntityTypeId(), $definition
    ->getTargetBundle());
  return $resolver
    ->resolve($items
    ->getEntity());
}