acquia_commercemanager-8.x-1.122/modules/acm_sku/src/Form/SKUDeleteForm.php
modules/acm_sku/src/Form/SKUDeleteForm.php
<?php
namespace Drupal\acm_sku\Form;
use Drupal\Core\Entity\ContentEntityConfirmFormBase;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Url;
/**
* Provides a form for deleting a acm_sku entity.
*
* @ingroup acm_sku
*/
class SKUDeleteForm extends ContentEntityConfirmFormBase {
/**
* {@inheritdoc}
*/
public function getQuestion() {
return $this->t('Are you sure you want to delete entity %name?', ['%name' => $this->entity->label()]);
}
/**
* {@inheritdoc}
*/
public function getCancelUrl() {
return new Url('entity.acm_sku.collection');
}
/**
* {@inheritdoc}
*/
public function getConfirmText() {
return $this->t('Delete');
}
/**
* {@inheritdoc}
*/
public function submitForm(array &$form, FormStateInterface $form_state) {
$entity = $this->getEntity();
$entity->delete();
\Drupal::logger('acm_sku')->notice('@type: deleted %title.',
[
'@type' => $this->entity->bundle(),
'%title' => $this->entity->label(),
]);
$form_state->setRedirect('entity.acm_sku.collection');
$form_state->setRedirect('entity.acm_sku.collection');
}
}
