File tree Expand file tree Collapse file tree 1 file changed +27
-0
lines changed Expand file tree Collapse file tree 1 file changed +27
-0
lines changed Original file line number Diff line number Diff line change 55 * Install, update and uninstall functions for the Product module.
66 */
77
8+ use Drupal\Core\Field\BaseFieldDefinition;
9+
810/**
911 * Change the path field to computed.
1012 */
@@ -32,3 +34,28 @@ function commerce_product_update_8202() {
3234 $entity_type->set('entity_keys', $keys);
3335 $definition_update_manager->updateEntityType($entity_type);
3436}
37+
38+ /**
39+ * Update the 'status' field.
40+ */
41+ function commerce_product_update_8203() {
42+ $definition_update_manager = \Drupal::entityDefinitionUpdateManager();
43+
44+ $storage_definition = BaseFieldDefinition::create('boolean')
45+ ->setName('status')
46+ ->setTargetEntityTypeId('commerce_product')
47+ ->setLabel(t('Published'))
48+ ->setRevisionable(TRUE)
49+ ->setTranslatable(TRUE)
50+ ->setDefaultValue(TRUE)
51+ ->setDisplayOptions('form', [
52+ 'type' => 'boolean_checkbox',
53+ 'settings' => [
54+ 'display_label' => TRUE,
55+ ],
56+ 'weight' => 90,
57+ ])
58+ ->setDisplayConfigurable('form', TRUE);
59+
60+ $definition_update_manager->updateFieldStorageDefinition($storage_definition);
61+ }
You can’t perform that action at this time.
0 commit comments