class DeleteForm

Builds a form to delete an action.

Hierarchy

Expanded class hierarchy of DeleteForm

1 string reference to 'DeleteForm'
action.routing.yml in drupal/core/modules/action/action.routing.yml
drupal/core/modules/action/action.routing.yml

File

drupal/core/modules/action/lib/Drupal/action/Form/DeleteForm.php, line 16
Contains \Drupal\action\Form\DeleteForm.

Namespace

Drupal\action\Form
View source
class DeleteForm extends ConfirmFormBase {

  /**
   * The action to be deleted.
   *
   * @var \Drupal\system\ActionConfigEntityInterface
   */
  protected $action;

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

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

  /**
   * {@inheritdoc}
   */
  protected function getCancelPath() {
    return 'admin/config/system/actions';
  }

  /**
   * {@inheritdoc}
   */
  public function getFormID() {
    return 'action_admin_delete_form';
  }

  /**
   * {@inheritdoc}
   */
  public function buildForm(array $form, array &$form_state, ActionConfigEntityInterface $action = NULL) {
    $this->action = $action;
    return parent::buildForm($form, $form_state);
  }

  /**
   * {@inheritdoc}
   */
  public function submitForm(array &$form, array &$form_state) {
    $this->action
      ->delete();
    watchdog('user', 'Deleted action %aid (%action)', array(
      '%aid' => $this->action
        ->id(),
      '%action' => $this->action
        ->label(),
    ));
    drupal_set_message(t('Action %action was deleted', array(
      '%action' => $this->action
        ->label(),
    )));
    $form_state['redirect'] = 'admin/config/system/actions';
  }

}

Members

Namesort descending Modifiers Type Description Overrides
ConfirmFormBase::getCancelText protected function Returns a caption for the link which cancels the action. 2
ConfirmFormBase::getDescription protected function Returns additional text to display as a description. 10
ConfirmFormBase::getFormName protected function Returns the internal name used to refer to the confirmation item.
ConfirmFormBase::validateForm public function Implements \Drupal\Core\Form\FormInterface::validateForm(). Overrides FormInterface::validateForm 1
DeleteForm::$action protected property The action to be deleted.
DeleteForm::buildForm public function Implements \Drupal\Core\Form\FormInterface::buildForm(). Overrides ConfirmFormBase::buildForm
DeleteForm::getCancelPath protected function Returns the page to go to if the user cancels the action. Overrides ConfirmFormBase::getCancelPath
DeleteForm::getConfirmText protected function Returns a caption for the button that confirms the action. Overrides ConfirmFormBase::getConfirmText
DeleteForm::getFormID public function Returns a unique string identifying the form. Overrides FormInterface::getFormID
DeleteForm::getQuestion protected function Returns the question to ask the user. Overrides ConfirmFormBase::getQuestion
DeleteForm::submitForm public function Form submission handler. Overrides FormInterface::submitForm