You are here

public function AdsenseRevenueSharingBasicSettings::submitForm in Google AdSense integration 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

oldcode/revenue_sharing_basic/src/Form/AdsenseRevenueSharingBasicSettings.php, line 118

Class

AdsenseRevenueSharingBasicSettings
Form for the adsense revenue sharing settings.

Namespace

Drupal\adsense_revenue_sharing_basic\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  $config = $this
    ->configFactory()
    ->getEditable('adsense_revenue_sharing_basic.settings');
  $form_state
    ->cleanValues();
  foreach ($form_state
    ->getValues() as $key => $value) {

    // Replace dashes with dots so that the mapping can be properly set.
    $config
      ->set(str_replace('-', '.', $key), $value);
  }
  $config
    ->save();
  parent::submitForm($form, $form_state);
}