You are here

public static function OrganizationType::preCreate in CRM Core 8

Same name and namespace in other branches
  1. 8.3 modules/crm_core_contact/src/Entity/OrganizationType.php \Drupal\crm_core_contact\Entity\OrganizationType::preCreate()
  2. 8.2 modules/crm_core_contact/src/Entity/OrganizationType.php \Drupal\crm_core_contact\Entity\OrganizationType::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

modules/crm_core_contact/src/Entity/OrganizationType.php, line 109

Class

OrganizationType
CRM Organization Type Entity Class.

Namespace

Drupal\crm_core_contact\Entity

Code

public static function preCreate(EntityStorageInterface $storage, array &$values) {
  parent::preCreate($storage, $values);

  // Ensure default values are set.
  $values += [
    'locked' => FALSE,
  ];
}