diff --git a/src/Entity/HelpTopic.php b/src/Entity/HelpTopic.php index 241b48f..a6a1d23 100644 --- a/src/Entity/HelpTopic.php +++ b/src/Entity/HelpTopic.php @@ -40,7 +40,7 @@ use Drupal\config_help\TextSectionPluginCollection; * "form" = { * "add" = "Drupal\config_help\Form\HelpTopicForm", * "edit" = "Drupal\config_help\Form\HelpTopicForm", - * "delete" = "Drupal\config_help\Form\HelpDeleteForm", + * "delete" = "Drupal\Core\Entity\EntityDeleteForm", * "lock" = "Drupal\config_help\Form\HelpLockForm", * "unlock" = "Drupal\config_help\Form\HelpUnlockForm", * }, diff --git a/src/Form/HelpDeleteForm.php b/src/Form/HelpDeleteForm.php deleted file mode 100644 index 9d09a07..0000000 --- a/src/Form/HelpDeleteForm.php +++ /dev/null @@ -1,52 +0,0 @@ -t('Are you sure you want to delete the topic %name?', ['%name' => $this->entity->label()]); - } - - /** - * {@inheritdoc} - */ - public function getConfirmText() { - return t('Delete'); - } - - /** - * {@inheritdoc} - */ - public function getCancelUrl() { - return new Url('entity.help_topic.collection'); - } - - /** - * {@inheritdoc} - */ - public function submitForm(array &$form, FormStateInterface $form_state) { - $this->entity->delete(); - drupal_set_message(t('Deleted help topic %name.', ['%name' => $this->entity->label()])); - - $form_state->setRedirectUrl($this->getCancelUrl()); - } - - /** - * {@inheritdoc} - */ - public function getDescription() { - return $this->t('This action cannot be undone.'); - } - -} diff --git a/tests/src/Functional/HelpTopicAdminTest.php b/tests/src/Functional/HelpTopicAdminTest.php index c875b0d..1cf06b4 100644 --- a/tests/src/Functional/HelpTopicAdminTest.php +++ b/tests/src/Functional/HelpTopicAdminTest.php @@ -244,12 +244,21 @@ class HelpTopicAdminTest extends BrowserTestBase { // Test deleting. $this->drupalGet('admin/config/development/help/' . $new_id . '/delete'); $this->assertText('This action cannot be undone.'); - $this->assertText('Are you sure you want to delete the topic'); + $this->assertText('Are you sure you want to delete the help topic'); $this->assertText($new_title); $this->drupalPostForm(NULL, [], 'Delete'); - $this->assertText('Deleted help topic'); + $this->assertText('The help topic'); + $this->assertText('has been deleted.'); $this->assertText($new_title); + // Verfiy we are back on the admin page and there is no longer a link + // to the topic we just deleted. + $this->assertLink('Add new help topic'); + $this->assertText('Help topics'); + $this->assertText('Title'); + $this->assertText('Machine name'); + $this->assertText('Operations'); $this->assertNoLink($new_title); + // Verify the topic is not on admin/help any more either. $this->drupalGet('admin/help'); $this->assertNoLink($new_title);