diff --git a/core/modules/shortcut/shortcut.module b/core/modules/shortcut/shortcut.module index 9776fb45e91..9f344660397 100644 --- a/core/modules/shortcut/shortcut.module +++ b/core/modules/shortcut/shortcut.module @@ -227,6 +227,8 @@ function shortcut_default_set($account = NULL) { * * @return * TRUE if a shortcut set with that title exists; FALSE otherwise. + * + * @deprecated in Drupal 8.x, will be removed before Drupal 9.0. */ function shortcut_set_title_exists($title) { $sets = ShortcutSet::loadMultiple(); diff --git a/core/modules/shortcut/src/Form/SwitchShortcutSet.php b/core/modules/shortcut/src/Form/SwitchShortcutSet.php index 897399714f5..0efa824273b 100644 --- a/core/modules/shortcut/src/Form/SwitchShortcutSet.php +++ b/core/modules/shortcut/src/Form/SwitchShortcutSet.php @@ -175,10 +175,6 @@ class SwitchShortcutSet extends FormBase { if (trim($form_state->getValue('label')) == '') { $form_state->setErrorByName('new', $this->t('The new set label is required.')); } - // Check to prevent a duplicate title. - if (shortcut_set_title_exists($form_state->getValue('label'))) { - $form_state->setErrorByName('label', $this->t('The shortcut set %name already exists. Choose another name.', array('%name' => $form_state->getValue('label')))); - } } } diff --git a/core/modules/shortcut/src/ShortcutSetForm.php b/core/modules/shortcut/src/ShortcutSetForm.php index cb5f43fada7..9708aee611d 100644 --- a/core/modules/shortcut/src/ShortcutSetForm.php +++ b/core/modules/shortcut/src/ShortcutSetForm.php @@ -48,18 +48,6 @@ class ShortcutSetForm extends EntityForm { return $form; } - /** - * {@inheritdoc} - */ - public function validate(array $form, FormStateInterface $form_state) { - parent::validate($form, $form_state); - $entity = $this->entity; - // Check to prevent a duplicate title. - if ($form_state->getValue('label') != $entity->label() && shortcut_set_title_exists($form_state->getValue('label'))) { - $form_state->setErrorByName('label', $this->t('The shortcut set %name already exists. Choose another name.', array('%name' => $form_state->getValue('label')))); - } - } - /** * {@inheritdoc} */ diff --git a/core/modules/shortcut/src/Tests/ShortcutSetsTest.php b/core/modules/shortcut/src/Tests/ShortcutSetsTest.php index be6c439dcea..417e91890b6 100644 --- a/core/modules/shortcut/src/Tests/ShortcutSetsTest.php +++ b/core/modules/shortcut/src/Tests/ShortcutSetsTest.php @@ -150,18 +150,6 @@ class ShortcutSetsTest extends ShortcutTestBase { $this->assertTrue($set->label() == $new_label, 'Shortcut set has been successfully renamed.'); } - /** - * Tests renaming a shortcut set to the same name as another set. - */ - function testShortcutSetRenameAlreadyExists() { - $set = $this->generateShortcutSet($this->randomMachineName()); - $existing_label = $this->set->label(); - $this->drupalPostForm('admin/config/user-interface/shortcut/manage/' . $set->id(), array('label' => $existing_label), t('Save')); - $this->assertRaw(t('The shortcut set %name already exists. Choose another name.', array('%name' => $existing_label))); - $set = ShortcutSet::load($set->id()); - $this->assertNotEqual($set->label(), $existing_label, format_string('The shortcut set %title cannot be renamed to %new-title because a shortcut set with that title already exists.', array('%title' => $set->label(), '%new-title' => $existing_label))); - } - /** * Tests unassigning a shortcut set. */