Loading modules/product/src/Form/ProductTypeForm.php +0 −6 Changes for modules/product/src/Form/ProductTypeForm.php: 0 added lines, 6 removed lines. Original line number Diff line number Diff line Loading @@ -72,12 +72,10 @@ class ProductTypeForm extends CommerceBundleEntityFormBase { // @todo Clean up once https://www.drupal.org/node/2318187 is fixed. if (in_array($this->operation, ['add', 'duplicate'])) { $product = $this->entityTypeManager->getStorage('commerce_product')->create(['type' => $product_type->uuid()]); $products_exist = FALSE; } else { $storage = $this->entityTypeManager->getStorage('commerce_product'); $product = $storage->create(['type' => $product_type->id()]); $products_exist = $storage->getQuery()->accessCheck(FALSE)->condition('type', $product_type->id())->execute(); } $form_state->set('original_entity', $this->entity->createDuplicate()); Loading Loading @@ -130,10 +128,6 @@ class ProductTypeForm extends CommerceBundleEntityFormBase { ], '#required' => !$product_type->isNew(), ]; if ($products_exist) { $form['variations']['variationTypes']['#disabled'] = TRUE; $form['variations']['variationTypes']['#description'] = $this->t('Products exist for this product type, you can no longer edit this setting.'); } $form['variations']['multipleVariations'] = [ '#type' => 'checkbox', '#title' => $this->t('Allow each product to have multiple variations.'), Loading modules/product/tests/src/Functional/ProductTypeTest.php +0 −12 Changes for modules/product/tests/src/Functional/ProductTypeTest.php: 0 added lines, 12 removed lines. Original line number Diff line number Diff line Loading @@ -143,9 +143,6 @@ class ProductTypeTest extends ProductBrowserTestBase { */ public function testEdit() { $this->drupalGet('admin/commerce/config/product-types/default/edit'); $variation_types_field = $this->getSession()->getPage()->findById('edit-variationtypes-default'); $this->assertFalse($variation_types_field->hasAttribute('disabled')); $edit = [ 'label' => 'Default!', 'description' => 'New description.', Loading Loading @@ -178,15 +175,6 @@ class ProductTypeTest extends ProductBrowserTestBase { // Confirm that the product display was updated. $form_display = commerce_get_entity_display('commerce_product', 'default', 'form'); $this->assertEmpty($form_display->getComponent('variations')); // Cannot change the variation type once a product has been created. $product = $this->createEntity('commerce_product', [ 'type' => 'default', 'title' => 'Test product', ]); $this->drupalGet('admin/commerce/config/product-types/default/edit'); $variation_type_field = $this->getSession()->getPage()->findField('edit-variationtypes-default'); $this->assertTrue($variation_type_field->hasAttribute('disabled')); } /** Loading Loading
modules/product/src/Form/ProductTypeForm.php +0 −6 Changes for modules/product/src/Form/ProductTypeForm.php: 0 added lines, 6 removed lines. Original line number Diff line number Diff line Loading @@ -72,12 +72,10 @@ class ProductTypeForm extends CommerceBundleEntityFormBase { // @todo Clean up once https://www.drupal.org/node/2318187 is fixed. if (in_array($this->operation, ['add', 'duplicate'])) { $product = $this->entityTypeManager->getStorage('commerce_product')->create(['type' => $product_type->uuid()]); $products_exist = FALSE; } else { $storage = $this->entityTypeManager->getStorage('commerce_product'); $product = $storage->create(['type' => $product_type->id()]); $products_exist = $storage->getQuery()->accessCheck(FALSE)->condition('type', $product_type->id())->execute(); } $form_state->set('original_entity', $this->entity->createDuplicate()); Loading Loading @@ -130,10 +128,6 @@ class ProductTypeForm extends CommerceBundleEntityFormBase { ], '#required' => !$product_type->isNew(), ]; if ($products_exist) { $form['variations']['variationTypes']['#disabled'] = TRUE; $form['variations']['variationTypes']['#description'] = $this->t('Products exist for this product type, you can no longer edit this setting.'); } $form['variations']['multipleVariations'] = [ '#type' => 'checkbox', '#title' => $this->t('Allow each product to have multiple variations.'), Loading
modules/product/tests/src/Functional/ProductTypeTest.php +0 −12 Changes for modules/product/tests/src/Functional/ProductTypeTest.php: 0 added lines, 12 removed lines. Original line number Diff line number Diff line Loading @@ -143,9 +143,6 @@ class ProductTypeTest extends ProductBrowserTestBase { */ public function testEdit() { $this->drupalGet('admin/commerce/config/product-types/default/edit'); $variation_types_field = $this->getSession()->getPage()->findById('edit-variationtypes-default'); $this->assertFalse($variation_types_field->hasAttribute('disabled')); $edit = [ 'label' => 'Default!', 'description' => 'New description.', Loading Loading @@ -178,15 +175,6 @@ class ProductTypeTest extends ProductBrowserTestBase { // Confirm that the product display was updated. $form_display = commerce_get_entity_display('commerce_product', 'default', 'form'); $this->assertEmpty($form_display->getComponent('variations')); // Cannot change the variation type once a product has been created. $product = $this->createEntity('commerce_product', [ 'type' => 'default', 'title' => 'Test product', ]); $this->drupalGet('admin/commerce/config/product-types/default/edit'); $variation_type_field = $this->getSession()->getPage()->findField('edit-variationtypes-default'); $this->assertTrue($variation_type_field->hasAttribute('disabled')); } /** Loading