You are here

public static function SocialAuth::preCreate in Social Auth 8.2

Same name and namespace in other branches
  1. 3.x 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 SocialApi::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);
}