You are here

FilebrowserDeleteForm.php in Filebrowser 8

Contains \Drupal\filebrowser\Entity\Form\FilebrowserDeleteForm

File

lib/Drupal/filebrowser/Entity/Form/FilebrowserDeleteForm.php
View source
<?php

/**
 * @file
 * Contains \Drupal\filebrowser\Entity\Form\FilebrowserDeleteForm
 */
namespace Drupal\ffilebrowser\Entity\Form;

use Drupal\Core\Entity\ContentEntityConfirmFormBase;

/**
 * Provides Confirmation form when deleting filebrowser content
 */
class FilebrowserDeleteForm extends ContentEntityConfirmFormBase {

  /**
   * {@inheritdoc}
   */
  public function getQuestion() {
    return t('Are you sure you want to delete entity %name?', array(
      '%name' => $this->entity
        ->label(),
    ));
  }

  /**
   * {@inheritdoc}
   */
  public function getCancelRoute() {
    return array(
      'route_name' => 'filebrowser.list',
    );
  }

  /**
   * {@inheritdoc}
   */
  public function getConfirmText() {
    return t('Delete');
  }

  /**
   * {@inheritdoc}
   */
  public function submit(array $form, array &$form_state) {
    $this->entity
      ->delete();
    watchdog('content', '@type: deleted %title.', array(
      '@type' => $this->entity
        ->bundle(),
      '%title' => $this->entity
        ->label(),
    ));
    $form_state['redirect_route']['route_name'] = 'filebrowser.list';
  }

}

Classes

Namesort descending Description
FilebrowserDeleteForm Provides Confirmation form when deleting filebrowser content