You are here

public function ShariffBlock::blockSubmit in Shariff Social Media Buttons 8

Overrides BlockPluginTrait::blockSubmit

File

src/Plugin/Block/ShariffBlock.php, line 379

Class

ShariffBlock
Provides a 'shariff' block.

Namespace

Drupal\shariff\Plugin\Block

Code

public function blockSubmit($form, FormStateInterface $form_state) {

  // Save our custom settings when the form is submitted.
  $values = $form_state
    ->getValues();
  $this
    ->setConfigurationValue('shariff_default_settings', $form_state
    ->getValue('shariff_default_settings'));

  // Only save values when default settings should be overwritten.
  if (!$form_state
    ->getValue('shariff_default_settings')) {
    foreach ($values as $setting => $value) {
      $this
        ->setConfigurationValue($setting, $form_state
        ->getValue($setting));
    }
  }
}