You are here

public function GoogleAnalyticsReportsApiAdminSettingsForm::adminSubmitSettings in Google Analytics Reports 8.3

Save Google Analytics Reports API settings.

File

google_analytics_reports_api/src/Form/GoogleAnalyticsReportsApiAdminSettingsForm.php, line 259

Class

GoogleAnalyticsReportsApiAdminSettingsForm
Represents the admin settings form for google_analytics_reports_api.

Namespace

Drupal\google_analytics_reports_api\Form

Code

public function adminSubmitSettings(array &$form, FormStateInterface $form_state) {
  $config = $this->configFactory
    ->getEditable('google_analytics_reports_api.settings');
  $config
    ->set('profile_id', $form_state
    ->getValue('profile_id'))
    ->set('cache_length', $form_state
    ->getValue('cache_length'))
    ->save();
  $this
    ->messenger()
    ->addMessage($this
    ->t('Settings have been saved successfully.'));
}