GoogleApiClientDeleteForm.php in Google API PHP Client 8.4
File
src/Form/GoogleApiClientDeleteForm.php
View source
<?php
namespace Drupal\google_api_client\Form;
use Drupal\Core\Entity\ContentEntityConfirmFormBase;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Url;
class GoogleApiClientDeleteForm extends ContentEntityConfirmFormBase {
public function getQuestion() {
return $this
->t('Are you sure you want to delete this account');
}
public function getDescription() {
return $this
->t("This account will be deleted from the system and won't be available");
}
public function getConfirmText() {
return $this
->t("Delete");
}
public function getCancelUrl() {
return new Url('entity.google_api_client.collection');
}
public function submitForm(array &$form, FormStateInterface $form_state) {
$google_api_client = $this->entity;
$google_api_client
->delete();
parent::submitForm($form, $form_state);
$this
->messenger()
->addMessage($this
->t('GoogleApiClient account deleted successfully'));
$this
->redirect('entity.google_api_client.collection')
->send();
}
}