Code Coverage |
||||||||||
Classes and Traits |
Functions and Methods |
Lines |
||||||||
Total | |
0.00% |
0 / 1 |
|
0.00% |
0 / 4 |
CRAP | |
0.00% |
0 / 9 |
FeedItemsDeleteForm | |
0.00% |
0 / 1 |
|
0.00% |
0 / 4 |
20 | |
0.00% |
0 / 9 |
getQuestion | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 2 |
|||
getCancelUrl | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 2 |
|||
getConfirmText | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 2 |
|||
submitForm | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 3 |
<?php | |
/** | |
* @file | |
* Contains \Drupal\aggregator\Form\FeedItemsDeleteForm. | |
*/ | |
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. | |
*/ | |
class FeedItemsDeleteForm extends ContentEntityConfirmFormBase { | |
/** | |
* {@inheritdoc} | |
*/ | |
public function getQuestion() { | |
return $this->t('Are you sure you want to delete all items from the feed %feed?', array('%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()); | |
} | |
} |