function commerce_recurring_update_8103 in Commerce Recurring Framework 8
Add the 'scheduled_changes' field to 'commerce_subscription' entities.
File
- ./
commerce_recurring.install, line 85 - Install, update and uninstall functions for the commerce_recurring module.
Code
function commerce_recurring_update_8103() {
\Drupal::service('plugin.manager.field.field_type')
->clearCachedDefinitions();
$storage_definition = BaseFieldDefinition::create('commerce_scheduled_change')
->setLabel(t('Scheduled changes'))
->setRequired(FALSE)
->setCardinality(BaseFieldDefinition::CARDINALITY_UNLIMITED)
->setDisplayOptions('view', [
'label' => 'hidden',
'type' => 'commerce_scheduled_change_default',
'weight' => 0,
])
->setDisplayConfigurable('form', FALSE)
->setDisplayConfigurable('view', TRUE);
$update_manager = \Drupal::entityDefinitionUpdateManager();
$update_manager
->installFieldStorageDefinition('scheduled_changes', 'commerce_subscription', 'commerce_recurring', $storage_definition);
}