WorkspaceDeleteForm.php in Opigno Moxtra 3.x
File
src/Form/WorkspaceDeleteForm.php
View source
<?php
namespace Drupal\opigno_moxtra\Form;
use Drupal\Core\Entity\ContentEntityConfirmFormBase;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Url;
class WorkspaceDeleteForm extends ContentEntityConfirmFormBase {
public function getQuestion() {
return $this
->t('Are you sure you want to delete the %workspace Collaborative Workspace?', [
'%workspace' => $this->entity
->label(),
]);
}
public function getConfirmText() {
return $this
->t('Delete');
}
public function getCancelUrl() {
return Url::fromRoute('opigno_moxtra.workspace', [
'opigno_moxtra_workspace' => $this->entity
->id(),
]);
}
public function submitForm(array &$form, FormStateInterface $form_state) {
$this->entity
->delete();
$this
->messenger()
->addMessage($this
->t('The Collaborative Workspace %workspace has been deleted.', [
'%workspace' => $this->entity
->label(),
]));
}
}