You are here

public function BetterSocialSharingButtonsForm::submitForm in Better Social Sharing Buttons 8

Same name and namespace in other branches
  1. 8.3 src/Form/BetterSocialSharingButtonsForm.php \Drupal\better_social_sharing_buttons\Form\BetterSocialSharingButtonsForm::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/BetterSocialSharingButtonsForm.php, line 154

Class

BetterSocialSharingButtonsForm
Class SettingsForm.

Namespace

Drupal\better_social_sharing_buttons\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  $config = $this
    ->config('better_social_sharing_buttons.settings');
  $config
    ->set('services', $form_state
    ->getValue('services'));
  $config
    ->set('width', $form_state
    ->getValue('width'));
  $config
    ->set('height', $form_state
    ->getValue('height'));
  $config
    ->set('radius', $form_state
    ->getValue('radius'));
  $config
    ->set('facebook_app_id', $form_state
    ->getValue('facebook_app_id'));
  $config
    ->set('iconset', $form_state
    ->getValue('iconset'));
  $config
    ->save();
  $message = $this
    ->t("Configuration saved !");
  $this
    ->messenger()
    ->addMessage($message);
}