You are here

public static function EntityLegalDocument::preCreate in Entity Legal 8.2

Same name and namespace in other branches
  1. 4.0.x src/Entity/EntityLegalDocument.php \Drupal\entity_legal\Entity\EntityLegalDocument::preCreate()
  2. 3.0.x src/Entity/EntityLegalDocument.php \Drupal\entity_legal\Entity\EntityLegalDocument::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/EntityLegalDocument.php, line 93

Class

EntityLegalDocument
Defines the entity legal document entity.

Namespace

Drupal\entity_legal\Entity

Code

public static function preCreate(EntityStorageInterface $storage, array &$values) {
  parent::preCreate($storage, $values);
  if (empty($values['settings']['title_pattern'])) {
    $values['settings']['title_pattern'] = '[entity_legal_document:label]';
  }
}