diff --git a/core/modules/comment/lib/Drupal/comment/Form/CommentTypeDeleteForm.php b/core/modules/comment/lib/Drupal/comment/Form/CommentTypeDeleteForm.php index f833197..c20577c 100644 --- a/core/modules/comment/lib/Drupal/comment/Form/CommentTypeDeleteForm.php +++ b/core/modules/comment/lib/Drupal/comment/Form/CommentTypeDeleteForm.php @@ -11,6 +11,7 @@ use Drupal\Core\Entity\EntityConfirmFormBase; use Drupal\Core\Entity\EntityManager; use Drupal\Core\Entity\Query\QueryFactory; +use Drupal\Core\Url; use Drupal\field\Entity\FieldConfig; use Symfony\Component\DependencyInjection\ContainerInterface; @@ -85,9 +86,7 @@ public function getQuestion() { * {@inheritdoc} */ public function getCancelRoute() { - return array( - 'route_name' => 'comment.type_list', - ); + return new Url('comment.type_list'); } /** @@ -106,7 +105,7 @@ public function buildForm(array $form, array &$form_state) { $caption = ''; foreach (array_keys($this->commentManager->getFields($entity_type)) as $field_name) { /** @var \Drupal\field\FieldConfigInterface $field */ - if (($field = FieldConfig::loadByName($entity_type, $field_name)) && $field->getSetting('comment_type') == $this->entity->id()) { + if (($field = FieldConfig::loadByName($entity_type, $field_name)) && $field->getSetting('comment_type') == $this->entity->id() && !$field->deleted) { $caption .= '

' . $this->t('%label is used by the %field field on your site. You can not remove this comment type until you have removed the field.', array( '%label' => $this->entity->label(), '%field' => $field->label(),