public static function GoogleApiClient::preCreate in Google API PHP Client 8.3
Same name and namespace in other branches
- 8.4 src/Entity/GoogleApiClient.php \Drupal\google_api_client\Entity\GoogleApiClient::preCreate()
- 8.2 src/Entity/GoogleApiClient.php \Drupal\google_api_client\Entity\GoogleApiClient::preCreate()
When a new entity instance is added, set the uid entity reference to the current user as the creator of the instance.
Overrides EntityBase::preCreate
File
- src/
Entity/ GoogleApiClient.php, line 560
Class
- GoogleApiClient
- Defines the GoogleApiClient entity.
Namespace
Drupal\google_api_client\EntityCode
public static function preCreate(EntityStorageInterface $storage_controller, array &$values) {
parent::preCreate($storage_controller, $values);
if (!isset($values['uid']) || $values['uid'] == NULL) {
$values += [
'uid' => \Drupal::currentUser()
->id(),
];
}
}