public function PostDeleteForm::buildForm in Open Social 10.3.x
Same name and namespace in other branches
- 8.9 modules/social_features/social_post/src/Form/PostDeleteForm.php \Drupal\social_post\Form\PostDeleteForm::buildForm()
- 8 modules/social_features/social_post/src/Form/PostDeleteForm.php \Drupal\social_post\Form\PostDeleteForm::buildForm()
- 8.2 modules/social_features/social_post/src/Form/PostDeleteForm.php \Drupal\social_post\Form\PostDeleteForm::buildForm()
- 8.3 modules/social_features/social_post/src/Form/PostDeleteForm.php \Drupal\social_post\Form\PostDeleteForm::buildForm()
- 8.4 modules/social_features/social_post/src/Form/PostDeleteForm.php \Drupal\social_post\Form\PostDeleteForm::buildForm()
- 8.5 modules/social_features/social_post/src/Form/PostDeleteForm.php \Drupal\social_post\Form\PostDeleteForm::buildForm()
- 8.6 modules/social_features/social_post/src/Form/PostDeleteForm.php \Drupal\social_post\Form\PostDeleteForm::buildForm()
- 8.7 modules/social_features/social_post/src/Form/PostDeleteForm.php \Drupal\social_post\Form\PostDeleteForm::buildForm()
- 8.8 modules/social_features/social_post/src/Form/PostDeleteForm.php \Drupal\social_post\Form\PostDeleteForm::buildForm()
- 10.0.x modules/social_features/social_post/src/Form/PostDeleteForm.php \Drupal\social_post\Form\PostDeleteForm::buildForm()
- 10.1.x modules/social_features/social_post/src/Form/PostDeleteForm.php \Drupal\social_post\Form\PostDeleteForm::buildForm()
- 10.2.x modules/social_features/social_post/src/Form/PostDeleteForm.php \Drupal\social_post\Form\PostDeleteForm::buildForm()
Form constructor.
Parameters
array $form: An associative array containing the structure of the form.
\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.
Return value
array The form structure.
Overrides ContentEntityDeleteForm::buildForm
1 call to PostDeleteForm::buildForm()
- SocialAlbumImageForm::buildForm in modules/
social_features/ social_album/ src/ Form/ SocialAlbumImageForm.php - Form constructor.
1 method overrides PostDeleteForm::buildForm()
- SocialAlbumImageForm::buildForm in modules/
social_features/ social_album/ src/ Form/ SocialAlbumImageForm.php - Form constructor.
File
- modules/
social_features/ social_post/ src/ Form/ PostDeleteForm.php, line 19
Class
- PostDeleteForm
- Provides a form for deleting Post entities.
Namespace
Drupal\social_post\FormCode
public function buildForm(array $form, FormStateInterface $form_state) {
$form = parent::buildForm($form, $form_state);
// Set the redirect url of the cancel button.
if (\Drupal::request()->query
->has('destination')) {
$destination = \Drupal::destination();
$path = $destination
->get();
$form['actions']['cancel']['#url'] = Url::fromUserInput($path);
}
else {
$curr_route_parr = \Drupal::routeMatch()
->getRawParameters()
->getDigits('post');
$redirect_url = Url::fromRoute('entity.post.edit_form', [
'post' => $curr_route_parr,
]);
$form['actions']['cancel']['#url'] = $redirect_url;
}
return $form;
}