You are here

function preview_link_update_8202 in Preview Link 2.x

Same name and namespace in other branches
  1. 2.0.x preview_link.install \preview_link_update_8202()

Updates Preview Link entity definition to remove faulty keys.

File

./preview_link.install, line 37
Install file.

Code

function preview_link_update_8202() : TranslatableMarkup {
  $entityTypeId = 'preview_link';
  $definitionUpdateManager = \Drupal::entityDefinitionUpdateManager();
  $entityType = $definitionUpdateManager
    ->getEntityType($entityTypeId);
  $keys = $entityType
    ->getKeys();
  $keys['entity_id'] = 'entity_id';
  $keys['entity_type_id'] = 'entity_type_id';
  $keys['token'] = 'token';
  $entityType
    ->set('entity_keys', $keys);
  $definitionUpdateManager
    ->updateEntityType($entityType);
  return \t("Updated Preview Link entity definition.");
}