You are here

public function FblikebuttonFormSettings::submitForm in Facebook Like Button 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/FblikebuttonFormSettings.php, line 175

Class

FblikebuttonFormSettings

Namespace

Drupal\fblikebutton\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  parent::submitForm($form, $form_state);
  $config = $this
    ->config('fblikebutton.settings');
  $node_types = $form_state
    ->getValue('fblikebutton_node_types');
  $full_node_display = $form_state
    ->getValue('fblikebutton_full_node_display');
  $teaser_display = $form_state
    ->getValue('fblikebutton_teaser_display');
  $layout = $form_state
    ->getValue('fblikebutton_layout');
  $show_faces = $form_state
    ->getValue('fblikebutton_show_faces');
  $action = $form_state
    ->getValue('fblikebutton_action');
  $font = $form_state
    ->getValue('fblikebutton_font');
  $color_scheme = $form_state
    ->getValue('fblikebutton_color_scheme');
  $weight = $form_state
    ->getValue('fblikebutton_weight');
  $language = $form_state
    ->getValue('fblikebutton_language');
  $config
    ->set('node_types', $node_types)
    ->set('full_node_display', $full_node_display)
    ->set('teaser_display', $teaser_display)
    ->set('layout', $layout)
    ->set('show_faces', $show_faces)
    ->set('action', $action)
    ->set('font', $font)
    ->set('color_scheme', $color_scheme)
    ->set('weight', $weight)
    ->set('language', $language)
    ->save();

  // Clear render cache
  $this
    ->clearCache();
}