ConditionalFieldDeleteFormTab.php in Conditional Fields 8
File
src/Form/ConditionalFieldDeleteFormTab.php
View source
<?php
namespace Drupal\conditional_fields\Form;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Url;
class ConditionalFieldDeleteFormTab extends ConditionalFieldDeleteForm {
protected $entity_type;
protected $bundle;
public function getCancelUrl() {
return Url::fromRoute('conditional_fields.tab' . "." . $this->entity_type, [
"{$this->entity_type}_type" => $this->bundle,
]);
}
public function getFormId() {
return 'conditional_field_delete_form_tab';
}
public function buildForm(array $form, FormStateInterface $form_state, $entity_type = NULL, $bundle = NULL, $field_name = NULL, $uuid = NULL) {
$this->entity_type = $entity_type;
$this->bundle = $bundle;
return parent::buildForm($form, $form_state, $entity_type, $bundle, $field_name, $uuid);
}
public function submitForm(array &$form, FormStateInterface $form_state) {
parent::submitForm($form, $form_state);
$form_state
->setRedirectUrl($this
->getCancelUrl());
}
}