You are here

function commerce_recurring_update_8104 in Commerce Recurring Framework 8

Add the 'next_renewal' field to 'commerce_subscription' entities.

File

./commerce_recurring.install, line 107
Install, update and uninstall functions for the commerce_recurring module.

Code

function commerce_recurring_update_8104() {
  $storage_definition = BaseFieldDefinition::create('timestamp')
    ->setLabel(t('Next renewal'))
    ->setDescription(t('The next renewal time.'))
    ->setDefaultValue(0)
    ->setDisplayOptions('view', [
    'label' => 'hidden',
    'type' => 'timestamp',
    'weight' => 0,
  ]);
  $update_manager = \Drupal::entityDefinitionUpdateManager();
  $update_manager
    ->installFieldStorageDefinition('next_renewal', 'commerce_subscription', 'commerce_recurring', $storage_definition);
}