FeedItemsDeleteForm.php

Same filename in other branches
  1. 8.9.x core/modules/aggregator/src/Form/FeedItemsDeleteForm.php

Namespace

Drupal\aggregator\Form

File

core/modules/aggregator/src/Form/FeedItemsDeleteForm.php

View source
<?php

namespace Drupal\aggregator\Form;

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

/**
 * Provides a deletion confirmation form for items that belong to a feed.
 *
 * @internal
 */
class FeedItemsDeleteForm extends ContentEntityConfirmFormBase {
    
    /**
     * {@inheritdoc}
     */
    public function getQuestion() {
        return $this->t('Are you sure you want to delete all items from the feed %feed?', [
            '%feed' => $this->entity
                ->label(),
        ]);
    }
    
    /**
     * {@inheritdoc}
     */
    public function getCancelUrl() {
        return new Url('aggregator.admin_overview');
    }
    
    /**
     * {@inheritdoc}
     */
    public function getConfirmText() {
        return $this->t('Delete items');
    }
    
    /**
     * {@inheritdoc}
     */
    public function submitForm(array &$form, FormStateInterface $form_state) {
        $this->entity
            ->deleteItems();
        $form_state->setRedirectUrl($this->getCancelUrl());
    }

}

Classes

Title Deprecated Summary
FeedItemsDeleteForm Provides a deletion confirmation form for items that belong to a feed.

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