You are here

public function CampaignMonitorAdminForm::submitForm in Campaign Monitor 8

Same name and namespace in other branches
  1. 8.2 src/Form/CampaignMonitorAdminForm.php \Drupal\campaignmonitor\Form\CampaignMonitorAdminForm::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 ConfigFormBase::submitForm

File

src/Form/CampaignMonitorAdminForm.php, line 162

Class

CampaignMonitorAdminForm
Configure campaignmonitor settings for this site.

Namespace

Drupal\campaignmonitor\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  $config = $this
    ->config('campaignmonitor.settings');
  $config
    ->set('api_key', $form_state
    ->getValue([
    'campaignmonitor_account',
    'api_key',
  ]))
    ->set('client_id', $form_state
    ->getValue([
    'campaignmonitor_account',
    'client_id',
  ]))
    ->set('cache_timeout', $form_state
    ->getValue([
    'campaignmonitor_general',
    'cache_timeout',
  ]))
    ->set('library_path', $form_state
    ->getValue([
    'campaignmonitor_general',
    'library_path',
  ]))
    ->set('archive', $form_state
    ->getValue([
    'campaignmonitor_general',
    'archive',
  ]))
    ->set('logging', $form_state
    ->getValue([
    'campaignmonitor_general',
    'logging',
  ]))
    ->set('instructions', $form_state
    ->getValue([
    'campaignmonitor_general',
    'instructions',
  ]))
    ->set('subscription_confirmation_text', $form_state
    ->getValue([
    'campaignmonitor_general',
    'subscription_confirmation_text',
  ]))
    ->set('cron', $form_state
    ->getValue('cron'))
    ->set('batch_limit', $form_state
    ->getValue('batch_limit'))
    ->save();
  parent::submitForm($form, $form_state);
}