BlockDeleteForm.php

Same filename in other branches
  1. 9 core/modules/block/src/Form/BlockDeleteForm.php
  2. 10 core/modules/block/src/Form/BlockDeleteForm.php
  3. 11.x core/modules/block/src/Form/BlockDeleteForm.php

Namespace

Drupal\block\Form

File

core/modules/block/src/Form/BlockDeleteForm.php

View source
<?php

namespace Drupal\block\Form;

use Drupal\Core\Entity\EntityDeleteForm;
use Drupal\Core\Url;

/**
 * Provides a deletion confirmation form for the block instance deletion form.
 *
 * @internal
 */
class BlockDeleteForm extends EntityDeleteForm {
    
    /**
     * {@inheritdoc}
     */
    public function getCancelUrl() {
        return new Url('block.admin_display');
    }
    
    /**
     * {@inheritdoc}
     */
    public function getConfirmText() {
        return $this->t('Remove');
    }
    
    /**
     * {@inheritdoc}
     */
    public function getQuestion() {
        return $this->t('Are you sure you want to remove the @entity-type %label?', [
            '@entity-type' => $this->getEntity()
                ->getEntityType()
                ->getSingularLabel(),
            '%label' => $this->getEntity()
                ->label(),
        ]);
    }
    
    /**
     * {@inheritdoc}
     */
    protected function getDeletionMessage() {
        $entity = $this->getEntity();
        return $this->t('The @entity-type %label has been removed.', [
            '@entity-type' => $entity->getEntityType()
                ->getSingularLabel(),
            '%label' => $entity->label(),
        ]);
    }

}

Classes

Title Deprecated Summary
BlockDeleteForm Provides a deletion confirmation form for the block instance deletion form.

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.