You are here

public function SimplenewsSubscriptionBlock::blockSubmit in Simplenews 8

Same name and namespace in other branches
  1. 8.2 src/Plugin/Block/SimplenewsSubscriptionBlock.php \Drupal\simplenews\Plugin\Block\SimplenewsSubscriptionBlock::blockSubmit()
  2. 3.x src/Plugin/Block/SimplenewsSubscriptionBlock.php \Drupal\simplenews\Plugin\Block\SimplenewsSubscriptionBlock::blockSubmit()

Overrides BlockPluginTrait::blockSubmit

File

src/Plugin/Block/SimplenewsSubscriptionBlock.php, line 150

Class

SimplenewsSubscriptionBlock
Provides an 'Simplenews subscription' block with all available newsletters and an email field.

Namespace

Drupal\simplenews\Plugin\Block

Code

public function blockSubmit($form, FormStateInterface $form_state) {
  $this->configuration['newsletters'] = array_filter($form_state
    ->getValue('newsletters'));
  $this->configuration['message'] = $form_state
    ->getValue('message');

  //$this->configuration['link_previous'] = $form_state->getValue('link_previous');

  //$this->configuration['rss_feed'] = $form_state->getValue('rss_feed');
  $this->configuration['unique_id'] = empty($form_state
    ->getValue('unique_id')) ? \Drupal::service('uuid')
    ->generate() : $form_state
    ->getValue('unique_id');
}