PostTypeDeleteForm.php in Open Social 10.2.x
Same filename and directory in other branches
- 8.9 modules/social_features/social_post/src/Form/PostTypeDeleteForm.php
- 8 modules/social_features/social_post/src/Form/PostTypeDeleteForm.php
- 8.2 modules/social_features/social_post/src/Form/PostTypeDeleteForm.php
- 8.3 modules/social_features/social_post/src/Form/PostTypeDeleteForm.php
- 8.4 modules/social_features/social_post/src/Form/PostTypeDeleteForm.php
- 8.5 modules/social_features/social_post/src/Form/PostTypeDeleteForm.php
- 8.6 modules/social_features/social_post/src/Form/PostTypeDeleteForm.php
- 8.7 modules/social_features/social_post/src/Form/PostTypeDeleteForm.php
- 8.8 modules/social_features/social_post/src/Form/PostTypeDeleteForm.php
- 10.3.x modules/social_features/social_post/src/Form/PostTypeDeleteForm.php
- 10.0.x modules/social_features/social_post/src/Form/PostTypeDeleteForm.php
- 10.1.x modules/social_features/social_post/src/Form/PostTypeDeleteForm.php
Namespace
Drupal\social_post\FormFile
modules/social_features/social_post/src/Form/PostTypeDeleteForm.phpView source
<?php
namespace Drupal\social_post\Form;
use Drupal\Core\Entity\EntityConfirmFormBase;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Url;
/**
* Builds the form to delete Post type entities.
*/
class PostTypeDeleteForm extends EntityConfirmFormBase {
/**
* {@inheritdoc}
*/
public function getQuestion() {
return $this
->t('Are you sure you want to delete %name?', [
'%name' => $this->entity
->label(),
]);
}
/**
* {@inheritdoc}
*/
public function getCancelUrl() {
return new Url('entity.post_type.collection');
}
/**
* {@inheritdoc}
*/
public function getConfirmText() {
return $this
->t('Delete');
}
/**
* {@inheritdoc}
*/
public function submitForm(array &$form, FormStateInterface $form_state) {
$this->entity
->delete();
$this
->messenger()
->addStatus($this
->t('content @type: deleted @label.', [
'@type' => $this->entity
->bundle(),
'@label' => $this->entity
->label(),
]));
$form_state
->setRedirectUrl($this
->getCancelUrl());
}
}
Classes
Name | Description |
---|---|
PostTypeDeleteForm | Builds the form to delete Post type entities. |