You are here

public function HubspotSettingsForm::submitForm in Hubspot forms 8

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/HubspotSettingsForm.php, line 77

Class

HubspotSettingsForm
Configure site information settings for this site.

Namespace

Drupal\hubspot_forms\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  $config = $this
    ->config('hubspot_forms.settings');

  // Enable/Disable plugin.
  $config
    ->set('hubspot_api_key', $form_state
    ->getValue('hubspot_api_key'))
    ->save();

  // Clear Drupal cache.
  \Drupal::cache()
    ->delete('hubspot_forms');
  parent::submitForm($form, $form_state);
}