You are here

public static function SocialAuth::preCreate in Social Auth 3.x

Same name and namespace in other branches
  1. 8.2 src/Entity/SocialAuth.php \Drupal\social_auth\Entity\SocialAuth::preCreate()

Changes the values of an entity before it is created.

Load defaults for example.

Parameters

\Drupal\Core\Entity\EntityStorageInterface $storage: The entity storage object.

mixed[] $values: An array of values to set, keyed by property name. If the entity type has bundles the bundle key has to be specified.

Overrides EntityBase::preCreate

File

src/Entity/SocialAuth.php, line 34

Class

SocialAuth
Defines the Social Auth entity.

Namespace

Drupal\social_auth\Entity

Code

public static function preCreate(EntityStorageInterface $storage, array &$values) {
  $additional_data = $values['additional_data'] ?? NULL;
  if ($additional_data) {
    $values['additional_data'] = static::encode($additional_data);
  }
  return parent::preCreate($storage, $values);
}