You are here

public function EditTexts::submitForm in TacJS 8.2

Same name and namespace in other branches
  1. 8.6 src/Form/Steps/EditTexts.php \Drupal\tacjs\Form\Steps\EditTexts::submitForm()
  2. 8.3 src/Form/Steps/EditTexts.php \Drupal\tacjs\Form\Steps\EditTexts::submitForm()
  3. 8.4 src/Form/Steps/EditTexts.php \Drupal\tacjs\Form\Steps\EditTexts::submitForm()
  4. 8.5 src/Form/Steps/EditTexts.php \Drupal\tacjs\Form\Steps\EditTexts::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 FormInterface::submitForm

File

src/Form/Steps/EditTexts.php, line 121

Class

EditTexts
Class EditTexts.

Namespace

Drupal\tacjs\Form\Steps

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  $config = \Drupal::getContainer()
    ->get('config.factory')
    ->getEditable('tacjs.settings');
  $texts = [
    'adblock',
    'adblock_call',
    'reload',
    'alertBigScroll',
    'alertBigClick',
    'alertBig',
    'alertBigPrivacy',
    'alertSmall',
    'personalize',
    'acceptAll',
    'close',
    'privacyUrl',
    'all',
    'info',
    'disclaimer',
    'allow',
    'deny',
    'noCookie',
    'useCookie',
    'useCookieCurrent',
    'useNoCookie',
    'more',
    'source',
    'credit',
    'toggleInfoBox',
    'title',
    'cookieDetail',
    'ourSite',
    'newWindow',
    'allowAll',
    'denyAll',
    'fallback',
    'ads_title',
    'ads_details',
    'analytic_title',
    'analytic_details',
    'social_title',
    'social_details',
    'video_title',
    'video_details',
    'comment_title',
    'comment_details',
    'support_title',
    'support_details',
    'api_title',
    'api_details',
    'other_title',
    'other_details',
  ];
  for ($i = 0; $i < count($texts); $i++) {
    $config
      ->set('texts.' . $texts[$i], $form_state
      ->getValue('texts')[$i]['destination']);
  }
  $config
    ->save();
}