You are here

public function AdminSettings::submitForm in HubSpot 8

Same name and namespace in other branches
  1. 3.x src/Form/AdminSettings.php \Drupal\hubspot\Form\AdminSettings::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/AdminSettings.php, line 203

Class

AdminSettings
Hubspot admin settings form.

Namespace

Drupal\hubspot\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  $this->configFactory
    ->getEditable(static::SETTINGS)
    ->set('hubspot_portal_id', $form_state
    ->getValue('hubspot_portal_id'))
    ->set('hubspot_client_id', $form_state
    ->getValue('hubspot_client_id'))
    ->set('hubspot_client_secret', $form_state
    ->getValue('hubspot_client_secret'))
    ->set('hubspot_scope', $form_state
    ->getValue('hubspot_scope'))
    ->set('hubspot_debug_email', $form_state
    ->getValue('hubspot_debug_email'))
    ->set('hubspot_debug_on', $form_state
    ->getValue('hubspot_debug_on'))
    ->set('tracking_code_on', $form_state
    ->getValue([
    'tracking_code_on',
  ]))
    ->save();
  $this
    ->messenger()
    ->addStatus($this
    ->t('The configuration options have been saved.'));
}