SalesforceMappingDeleteForm.php in Salesforce Suite 8.4        
                          
                  
                        
  
  
  
  
File
  modules/salesforce_mapping_ui/src/Form/SalesforceMappingDeleteForm.php
  
    View source  
  <?php
namespace Drupal\salesforce_mapping_ui\Form;
use Drupal\Core\Entity\EntityConfirmFormBase;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Url;
class SalesforceMappingDeleteForm extends EntityConfirmFormBase {
  
  public function getQuestion() {
    return $this
      ->t('Are you sure you want to delete the mapping %name?', [
      '%name' => $this->entity
        ->label(),
    ]);
  }
  
  public function getCancelUrl() {
    return new Url('entity.salesforce_mapping.list');
  }
  
  public function getConfirmText() {
    return $this
      ->t('Delete');
  }
  
  public function submitForm(array &$form, FormStateInterface $form_state) {
    $this->entity
      ->delete();
    
    $this
      ->messenger()
      ->addStatus($this
      ->t('Salesforce %label was deleted.', [
      '%label' => $this->entity
        ->label(),
    ]));
    $form_state
      ->setRedirectUrl($this
      ->getCancelUrl());
  }
}