You are here

public static function UserConsentItem::propertyDefinitions in General Data Protection Regulation 8

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

Defines field item properties.

Properties that are required to constitute a valid, non-empty item should be denoted with \Drupal\Core\TypedData\DataDefinition::setRequired().

Return value

\Drupal\Core\TypedData\DataDefinitionInterface[] An array of property definitions of contained properties, keyed by property name.

Overrides FieldItemInterface::propertyDefinitions

See also

\Drupal\Core\Field\BaseFieldDefinition

File

modules/gdpr_consent/src/Plugin/Field/FieldType/UserConsentItem.php, line 38

Class

UserConsentItem
Plugin implementation of the 'gdpr_user_consent' field type.

Namespace

Drupal\gdpr_consent\Plugin\Field\FieldType

Code

public static function propertyDefinitions(FieldStorageDefinitionInterface $field_definition) {
  $properties['target_id'] = DataReferenceTargetDefinition::create('integer')
    ->setLabel('Target agreement ID')
    ->setSetting('unsigned', TRUE)
    ->setRequired(TRUE);
  $properties['target_revision_id'] = DataDefinition::create('integer')
    ->setLabel('Revision ID');
  $properties['agreed'] = DataDefinition::create('boolean')
    ->setLabel('Agreed');
  $properties['date'] = DataDefinition::create('datetime_iso8601')
    ->setLabel('Date stored');
  $properties['user_id'] = DataReferenceTargetDefinition::create('integer')
    ->setLabel('User ID');
  $properties['user_id_accepted'] = DataReferenceTargetDefinition::create('integer')
    ->setLabel('User ID Accepted');
  $properties['notes'] = DataReferenceTargetDefinition::create('string')
    ->setLabel('Notes');
  return $properties;
}