You are here

ConditionalFieldDeleteFormTab.php in Conditional Fields 8

Same filename and directory in other branches
  1. 4.x src/Form/ConditionalFieldDeleteFormTab.php

File

src/Form/ConditionalFieldDeleteFormTab.php
View source
<?php

namespace Drupal\conditional_fields\Form;

use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Url;

/**
 * Class ConditionalFieldDeleteFormTab.
 *
 * @package Drupal\conditional_fields\Form
 */
class ConditionalFieldDeleteFormTab extends ConditionalFieldDeleteForm {
  protected $entity_type;
  protected $bundle;

  /**
   * {@inheritdoc}
   */
  public function getCancelUrl() {
    return Url::fromRoute('conditional_fields.tab' . "." . $this->entity_type, [
      "{$this->entity_type}_type" => $this->bundle,
    ]);
  }

  /**
   * {@inheritdoc}
   */
  public function getFormId() {
    return 'conditional_field_delete_form_tab';
  }

  /**
   * {@inheritdoc}
   */
  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);
  }

  /**
   * {@inheritdoc}
   */
  public function submitForm(array &$form, FormStateInterface $form_state) {
    parent::submitForm($form, $form_state);
    $form_state
      ->setRedirectUrl($this
      ->getCancelUrl());
  }

}

Classes

Namesort descending Description
ConditionalFieldDeleteFormTab Class ConditionalFieldDeleteFormTab.