diff --git a/core/modules/node/src/NodeTypeForm.php b/core/modules/node/src/NodeTypeForm.php index 03ae107..c3addc5 100644 --- a/core/modules/node/src/NodeTypeForm.php +++ b/core/modules/node/src/NodeTypeForm.php @@ -220,7 +220,7 @@ public function validateForm(array &$form, FormStateInterface $form_state) { if ($original_type && isset($disallowed_names[$original_type])) { unset($disallowed_names[$original_type]); } - if (in_array($name, $disallowed_names)) { + if (preg_grep('/^' . $name . '$/i', $disallowed_names)) { $form_state->setErrorByName('name', $this->t('The human-readable name %name is already taken.', array('%name' => $name))); } } diff --git a/core/modules/node/src/Tests/NodeTypeTest.php b/core/modules/node/src/Tests/NodeTypeTest.php index 9337b54..a23ebd2 100644 --- a/core/modules/node/src/Tests/NodeTypeTest.php +++ b/core/modules/node/src/Tests/NodeTypeTest.php @@ -93,6 +93,11 @@ public function testNodeTypeUnique() { $this->drupalPostForm('admin/structure/types/add', $edit, t('Save and manage fields')); $this->assertText(t('The human-readable name foo is already taken.')); + // Attempt to create a content type with the same name (case insensitive). + $edit['name'] = 'Foo'; + $this->drupalPostForm('admin/structure/types/add', $edit, t('Save and manage fields')); + $this->assertText(t('The human-readable name Foo is already taken.')); + // Attempt to create a content type with a different name. $edit['name'] = 'foo_2'; $this->drupalPostForm('admin/structure/types/add', $edit, t('Save and manage fields'));