You are here

SocialSwiftmailSettingsForm.php in Open Social 8.3

File

modules/social_features/social_swiftmail/src/Form/SocialSwiftmailSettingsForm.php
View source
<?php

namespace Drupal\social_swiftmail\Form;

use Drupal\Core\Form\ConfigFormBase;
use Drupal\Core\Form\FormStateInterface;

/**
 * Class SocialSwiftmailSettingsForm.
 *
 * @package Drupal\social_swiftmail\Form
 */
class SocialSwiftmailSettingsForm extends ConfigFormBase {

  /**
   * {@inheritdoc}
   */
  protected function getEditableConfigNames() {
    return [
      'social_swiftmail.settings',
    ];
  }

  /**
   * {@inheritdoc}
   */
  public function getFormId() {
    return 'social_swiftmail_form';
  }

  /**
   * {@inheritdoc}
   */
  public function buildForm(array $form, FormStateInterface $form_state) {
    $config = $this
      ->config('social_swiftmail.settings');
    $form['remove_open_social_branding'] = [
      '#type' => 'checkbox',
      '#title' => $this
        ->t('Remove Open Social Branding'),
      '#description' => $this
        ->t('Open Social Branding will be replaced by site name (and slogan if available).'),
      '#default_value' => $config
        ->get('remove_open_social_branding'),
    ];
    return parent::buildForm($form, $form_state);
  }

  /**
   * {@inheritdoc}
   */
  public function submitForm(array &$form, FormStateInterface $form_state) {
    parent::submitForm($form, $form_state);
    $this
      ->config('social_swiftmail.settings')
      ->set('remove_open_social_branding', $form_state
      ->getValue('remove_open_social_branding'))
      ->save();
  }

}

Classes

Namesort descending Description
SocialSwiftmailSettingsForm Class SocialSwiftmailSettingsForm.