You are here

function lingotek_update_9401 in Lingotek Translation 4.0.x

Same name and namespace in other branches
  1. 3.4.x lingotek.install \lingotek_update_9401()
  2. 3.5.x lingotek.install \lingotek_update_9401()
  3. 3.6.x lingotek.install \lingotek_update_9401()
  4. 3.7.x lingotek.install \lingotek_update_9401()
  5. 3.8.x lingotek.install \lingotek_update_9401()

Adds initial upload and updated date fields to Lingotek metadata entities.

File

./lingotek.install, line 159
Install, update and uninstall functions for the lingotek module.

Code

function lingotek_update_9401() {
  $fields = [];
  $fields['updated_timestamp'] = BaseFieldDefinition::create('timestamp')
    ->setLabel(new TranslatableMarkup('Updated timestamp'))
    ->setDescription(new TranslatableMarkup('The last time document was updated.'));
  $fields['uploaded_timestamp'] = BaseFieldDefinition::create('timestamp')
    ->setLabel(new TranslatableMarkup('Initial upload'))
    ->setDescription(new TranslatableMarkup('The time of the initial upload.'));
  $entity_definition_update_manager = \Drupal::entityDefinitionUpdateManager();
  foreach ($fields as $name => $storage_definition) {
    $entity_definition_update_manager
      ->installFieldStorageDefinition($name, 'lingotek_content_metadata', 'lingotek', $storage_definition);
  }
}