IdpDeleteForm.php in SAML Service Provider 8.2
Same filename and directory in other branches
Delete a single idp
Namespace
Drupal\saml_sp\FormFile
src/Form/IdpDeleteForm.phpView source
<?php
/**
* @file
* Delete a single idp
*/
namespace Drupal\saml_sp\Form;
use Drupal\Core\Form\ConfirmFormBase;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Url;
use Drupal\Core\Entity\EntityDeleteForm;
class IdpDeleteForm extends EntityDeleteForm {
/**
* The IDP to delete.
*
* @var array
*/
protected $idp;
/**
* {@inheritdoc}.
*/
public function getFormId() {
return 'saml_sp_idp_delete';
}
/**
* {@inheritdoc}
*/
public function getQuestion() {
return $this
->t('Are you sure you want to delete the Identity Provider %name?', array(
'%name' => $this->entity
->label(),
));
}
/**
* {@inheritdoc}
*/
public function getCancelUrl() {
//this needs to be a valid route otherwise the cancel link won't appear
return new Url('entity.idp.collection');
}
/**
* {@inheritdoc}
*/
public function getDescription() {
return t('Only do this if you are sure!');
}
/**
* {@inheritdoc}
*/
public function getConfirmText() {
return $this
->t('Delete');
}
/**
* {@inheritdoc}
*/
public function getCancelText() {
return $this
->t('Nevermind');
}
/**
* {@inheritdoc}
*
* @param int $id
* (optional) The ID of the item to be deleted.
*/
public function form(array $form, FormStateInterface $form_state) {
return parent::form($form, $form_state);
}
/**
* {@inheritdoc}
*/
public function submitForm(array &$form, FormStateInterface $form_state) {
$this->entity
->delete();
drupal_set_message($this
->t('Identity Provider %label has been deleted.', array(
'%label' => $this->entity
->label(),
)));
$form_state
->setRedirectUrl($this
->getCancelUrl());
}
}
Classes
Name | Description |
---|---|
IdpDeleteForm |