Updated Drupal to 8.6. This goes with the following updates because it's possible...
[yaffs-website] / vendor / chi-teck / drupal-code-generator / templates / d8 / form / confirm.twig
index 4e28d6498c5deb4d2bff7c33cc0c442616a7da23..903bb1e13e07054be93fef484cb40fcd22567073 100644 (file)
@@ -2,43 +2,15 @@
 
 namespace Drupal\{{ machine_name }}\Form;
 
-use Drupal\Core\Database\Connection;
 use Drupal\Core\Form\ConfirmFormBase;
 use Drupal\Core\Form\FormStateInterface;
 use Drupal\Core\Url;
-use Symfony\Component\DependencyInjection\ContainerInterface;
 
 /**
  * Provides a confirmation form before clearing out the examples.
  */
 class {{ class }} extends ConfirmFormBase {
 
-  /**
-   * The database connection.
-   *
-   * @var \Drupal\Core\Database\Connection
-   */
-  protected $connection;
-
-  /**
-   * Constructs new {{ class }} object.
-   *
-   * @param \Drupal\Core\Database\Connection $connection
-   *   The database connection.
-   */
-  public function __construct(Connection $connection) {
-    $this->connection = $connection;
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public static function create(ContainerInterface $container) {
-    return new static(
-      $container->get('database')
-    );
-  }
-
   /**
    * {@inheritdoc}
    */
@@ -50,22 +22,22 @@ class {{ class }} extends ConfirmFormBase {
    * {@inheritdoc}
    */
   public function getQuestion() {
-    return $this->t('Are you sure you want to delete all examples?');
+    return $this->t('Are you sure you want to do this?');
   }
 
   /**
    * {@inheritdoc}
    */
   public function getCancelUrl() {
-    return new Url('system.admin');
+    return new Url('system.admin_config');
   }
 
   /**
    * {@inheritdoc}
    */
   public function submitForm(array &$form, FormStateInterface $form_state) {
-    $this->connection->delete('examples')->execute();
-    drupal_set_message($this->t('The examples have been deleted.'));
+    // @DCG Place your code here.
+    $this->messenger()->addStatus($this->t('Done!'));
     $form_state->setRedirectUrl($this->getCancelUrl());
   }