You are here

public function TwitterFeedsDeleteForm::submitForm in Tweet Feed 4.x

Same name and namespace in other branches
  1. 8.3 src/Form/TwitterFeedsDeleteForm.php \Drupal\tweet_feed\Form\TwitterFeedsDeleteForm::submitForm()

Form submission handler.

Parameters

array $form: An associative array containing the structure of the form.

\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.

Overrides FormInterface::submitForm

File

src/Form/TwitterFeedsDeleteForm.php, line 36

Class

TwitterFeedsDeleteForm
Confirmation of Twitter API deletion.

Namespace

Drupal\tweet_feed\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  $config = \Drupal::service('config.factory')
    ->getEditable('tweet_feed.twitter_feeds');
  $feeds = $config
    ->get('feeds');
  unset($feeds[$this->feed_machine_name]);
  $config
    ->set('feeds', $feeds)
    ->save();
  \Drupal::messenger()
    ->addStatus($this
    ->t('The Twitter Feed %feed was deleted.', [
    '%feed' => $this->feed_machine_name,
  ]));
  $form_state
    ->setRedirect('tweet_feed.twitter_feeds');
  return;
}