You are here

function commerce_wishlist_update_8302 in Commerce Wishlist 8.3

Add the 'comment' and 'priority' fields to commerce_wishlist_item entities.

File

./commerce_wishlist.install, line 40
Contains install and update functions for Commerce Wishlist.

Code

function commerce_wishlist_update_8302() {
  $definition_update_manager = \Drupal::entityDefinitionUpdateManager();
  $storage_definition = BaseFieldDefinition::create('string_long')
    ->setLabel(t('Comment'))
    ->setDescription(t('The item comment.'))
    ->setDefaultValue('')
    ->setDisplayOptions('form', [
    'type' => 'string_textarea',
    'weight' => 25,
    'settings' => [
      'rows' => 4,
    ],
  ]);
  $definition_update_manager
    ->installFieldStorageDefinition('comment', 'commerce_wishlist_item', 'commerce_wishlist', $storage_definition);
  $storage_definition = BaseFieldDefinition::create('integer')
    ->setLabel(t('Priority'))
    ->setDescription(t('The item priority.'))
    ->setDefaultValue(0);
  $definition_update_manager
    ->installFieldStorageDefinition('priority', 'commerce_wishlist_item', 'commerce_wishlist', $storage_definition);
}