You are here

function commerce_product_update_8203 in Commerce Core 8.2

Update the product 'status' field.

File

modules/product/commerce_product.install, line 54
Install, update and uninstall functions for the Product module.

Code

function commerce_product_update_8203() {
  $definition_update_manager = \Drupal::entityDefinitionUpdateManager();
  $storage_definition = BaseFieldDefinition::create('boolean')
    ->setName('status')
    ->setTargetEntityTypeId('commerce_product')
    ->setLabel(t('Published'))
    ->setRevisionable(TRUE)
    ->setTranslatable(TRUE)
    ->setDefaultValue(TRUE)
    ->setDisplayOptions('form', [
    'type' => 'boolean_checkbox',
    'settings' => [
      'display_label' => TRUE,
    ],
    'weight' => 90,
  ])
    ->setDisplayConfigurable('form', TRUE);
  $definition_update_manager
    ->updateFieldStorageDefinition($storage_definition);
}