public static function Conditions::preCreate in Legal 2.0.x
Same name and namespace in other branches
- 8 src/Entity/Conditions.php \Drupal\legal\Entity\Conditions::preCreate()
When a new entity instance is added, set the user_id entity reference to the current user as the creator of the instance.
Overrides EntityBase::preCreate
File
- src/
Entity/ Conditions.php, line 40
Class
- Conditions
- Defines the Legal Terms & Conditions entity.
Namespace
Drupal\legal\EntityCode
public static function preCreate(EntityStorageInterface $storage_controller, array &$values) {
parent::preCreate($storage_controller, $values);
$values += [
'user_id' => \Drupal::currentUser()
->id(),
];
}