/**
  * {@inheritdoc}
  */
 public function submitForm(array &$form, FormStateInterface $formState)
 {
     $this->entity->delete();
     drupal_set_message($this->t('The empty page callback for %title has been deleted.', array('%title' => $this->entity->getTitle())));
     $this->emptyPageManager->rebuildRoutes();
     $formState->setRedirectUrl($this->getCancelUrl());
 }
 /**
  * Validate the path to make sure it does not already exist.
  *
  * @param array $element
  *   The form element to validate.
  *
  * @param FormStateInterface $formState
  *   The form state.
  */
 public function validateUniquePathName(array &$element, FormStateInterface $formState)
 {
     $path = $formState->getValue('path');
     // If the path is the same as the current path on the entity there is no
     // need to validate.
     if ($this->entity->getPath() === $path) {
         return;
     }
     if ($this->emptyPageManager->routeExists($path)) {
         $formState->setError($element, $this->t('A route with this path already exists.'));
     }
 }