Loading core/modules/taxonomy/src/VocabularyListBuilder.php +3 −2 Original line number Diff line number Diff line Loading @@ -109,6 +109,9 @@ public function getDefaultOperations(EntityInterface $entity) { if (isset($operations['edit'])) { $operations['edit']['title'] = t('Edit vocabulary'); } if (isset($operations['delete'])) { $operations['delete']['title'] = $this->t('Delete vocabulary'); } if ($entity->access('access taxonomy overview')) { $operations['list'] = [ Loading @@ -127,8 +130,6 @@ public function getDefaultOperations(EntityInterface $entity) { ]; } unset($operations['delete']); return $operations; } Loading core/modules/taxonomy/tests/src/Functional/VocabularyUiTest.php +16 −0 Original line number Diff line number Diff line Loading @@ -2,6 +2,7 @@ namespace Drupal\Tests\taxonomy\Functional; use Drupal\Component\Render\FormattableMarkup; use Drupal\Core\Url; use Drupal\taxonomy\Entity\Vocabulary; Loading Loading @@ -88,6 +89,21 @@ public function testVocabularyInterface() { $site_name = $this->config('system.site')->get('name'); $this->assertSession()->titleEquals("Don't Panic | $site_name"); // Delete the vocabulary. $this->drupalGet('admin/structure/taxonomy'); $href = Url::fromRoute('entity.taxonomy_vocabulary.delete_form', ['taxonomy_vocabulary' => $edit['vid']])->toString(); $xpath = $this->assertSession()->buildXPathQuery('//a[contains(@href, :href)]', [':href' => $href]); $link = $this->assertSession()->elementExists('xpath', $xpath); $this->assertEquals('Delete vocabulary', $link->getText()); $link->click(); // Confirm deletion. $this->assertSession()->responseContains(new FormattableMarkup('Are you sure you want to delete the vocabulary %name?', ['%name' => $edit['name']])); $this->submitForm([], 'Delete'); $this->assertSession()->responseContains(new FormattableMarkup('Deleted vocabulary %name.', ['%name' => $edit['name']])); $this->container->get('entity_type.manager')->getStorage('taxonomy_vocabulary')->resetCache(); $this->assertNull(Vocabulary::load($edit['vid']), 'Vocabulary not found.'); } /** Loading Loading
core/modules/taxonomy/src/VocabularyListBuilder.php +3 −2 Original line number Diff line number Diff line Loading @@ -109,6 +109,9 @@ public function getDefaultOperations(EntityInterface $entity) { if (isset($operations['edit'])) { $operations['edit']['title'] = t('Edit vocabulary'); } if (isset($operations['delete'])) { $operations['delete']['title'] = $this->t('Delete vocabulary'); } if ($entity->access('access taxonomy overview')) { $operations['list'] = [ Loading @@ -127,8 +130,6 @@ public function getDefaultOperations(EntityInterface $entity) { ]; } unset($operations['delete']); return $operations; } Loading
core/modules/taxonomy/tests/src/Functional/VocabularyUiTest.php +16 −0 Original line number Diff line number Diff line Loading @@ -2,6 +2,7 @@ namespace Drupal\Tests\taxonomy\Functional; use Drupal\Component\Render\FormattableMarkup; use Drupal\Core\Url; use Drupal\taxonomy\Entity\Vocabulary; Loading Loading @@ -88,6 +89,21 @@ public function testVocabularyInterface() { $site_name = $this->config('system.site')->get('name'); $this->assertSession()->titleEquals("Don't Panic | $site_name"); // Delete the vocabulary. $this->drupalGet('admin/structure/taxonomy'); $href = Url::fromRoute('entity.taxonomy_vocabulary.delete_form', ['taxonomy_vocabulary' => $edit['vid']])->toString(); $xpath = $this->assertSession()->buildXPathQuery('//a[contains(@href, :href)]', [':href' => $href]); $link = $this->assertSession()->elementExists('xpath', $xpath); $this->assertEquals('Delete vocabulary', $link->getText()); $link->click(); // Confirm deletion. $this->assertSession()->responseContains(new FormattableMarkup('Are you sure you want to delete the vocabulary %name?', ['%name' => $edit['name']])); $this->submitForm([], 'Delete'); $this->assertSession()->responseContains(new FormattableMarkup('Deleted vocabulary %name.', ['%name' => $edit['name']])); $this->container->get('entity_type.manager')->getStorage('taxonomy_vocabulary')->resetCache(); $this->assertNull(Vocabulary::load($edit['vid']), 'Vocabulary not found.'); } /** Loading