You are here

public function DebugForm::submitForm in CMS Content Sync 8

Same name and namespace in other branches
  1. 2.1.x src/Form/DebugForm.php \Drupal\cms_content_sync\Form\DebugForm::submitForm()
  2. 2.0.x src/Form/DebugForm.php \Drupal\cms_content_sync\Form\DebugForm::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/DebugForm.php, line 250

Class

DebugForm
Content Sync advanced debug form.

Namespace

Drupal\cms_content_sync\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  parent::submitForm($form, $form_state);
  $settings = ContentSyncSettings::getInstance();
  $settings
    ->setExtendedEntityExportLogging($form_state
    ->getValue('cms_content_sync_extended_entity_export_logging'));
  $settings
    ->setExtendedEntityImportLogging($form_state
    ->getValue('cms_content_sync_extended_entity_import_logging'));
  if ('Login at Sync Core' == $form_state
    ->getValue('op')) {
    $messenger = \Drupal::messenger();
    foreach (SyncCoreFactory::getAllSyncCores() as $host => $core) {
      if ($core
        ->getSyndicationService()
        ->refreshAuthentication()) {
        $messenger
          ->addStatus('SUCCESS login from Sync Core at ' . $host);
      }
      else {
        $messenger
          ->addError('FAILED to login from Sync Core at ' . $host);
      }
    }
  }
}